def clean_names(lines, ensure_unique_names=False, strip_prefix=False,
                make_database_safe=False):
    """
    Clean the names.

    Options to:
     - strip prefixes on names
     - enforce unique names
     - make database safe names by converting - to _
    """
    names = {}

    for row in lines:
        if strip_prefix:
            row['name'] = row['name'][row['name'].find('-') + 1:]

            if row['indexed_by'] is not None:
                row['indexed_by'] = row['indexed_by'][row['indexed_by'].find(
                    '-') + 1:]

        if ensure_unique_names:
            i = 1
            while (row['name'] if i == 1 else
                   row['name'] + "-" + str(i)) in names:
                i += 1

            names[row['name'] if i == 1 else row['name'] + "-" + str(i)] = 1

            if i > 1:
                row['name'] = row['name'] + "-" + str(i)

        if make_database_safe:
            row['name'] = row['name'].replace("-", "_")
    return lines
Clean the names.

    Options to:
     - strip prefixes on names
     - enforce unique names
     - make database safe names by converting - to _