human
Complete this python program:
def _raise_if_duplicate_entry_error(integrity_error, engine_name):
assistant
#Here is the Python program you requested.

    """Raise exception if two entries are duplicated.
    In this function will be raised DBDuplicateEntry exception if integrity
    error wrap unique constraint violation.
    """
    def get_columns_from_uniq_cons_or_name(columns):
        uniqbase = 'uniq_'
        if (not columns.startswith(uniqbase)):
            if (engine_name == 'postgresql'):
                return [columns[(columns.index('_') + 1):columns.rindex('_')]]
            return [columns]
        return columns[len(uniqbase):].split('0')[1:]
    if (engine_name not in ['mysql', 'sqlite', 'postgresql']):
        return
    m = _DUP_KEY_RE_DB[engine_name].match(integrity_error.message)
    if (not m):
        return
    columns = m.group(1)
    if (engine_name == 'sqlite'):
        columns = columns.strip().split(',    ')
    else:
        columns = get_columns_from_uniq_cons_or_name(columns)
    raise exception.DBDuplicateEntry(columns, integrity_error)