def _generate_indices(conn, table: str):
    """
    Using the existing table as a template, generate CREATE INDEX statements for
    the new table.

    :param conn: A connection to the API database.
    :param table: The table to be updated.
    :return: A list of CREATE INDEX statements.
    """
    def _clean_idxs(indices):
        # Remove names of indices. We don't want to collide with the old names;
        # we want the database to generate them for us upon recreating the
        # table.
        cleaned = []
        for index in indices:
            # The index name is always after CREATE [UNIQUE] INDEX; delete it.
            tokens = index[0].split(' ')
            index_idx = tokens.index('INDEX')
            del tokens[index_idx + 1]
            # The table name is always after ON. Rename it to match the
            # temporary copy of the data.
            on_idx = tokens.index('ON')
            table_name_idx = on_idx + 1
            schema_name, table_name = tokens[table_name_idx].split('.')
            new_table_name = 'temp_import_{}'.format(table_name)
            tokens[table_name_idx] = schema_name + '.' + new_table_name
            if 'id' not in index:
                cleaned.append(' '.join(tokens))

        return cleaned

    # Get all of the old indices from the existing table.
    get_idxs = "SELECT indexdef FROM pg_indexes WHERE tablename = '{}'"\
        .format(table)

    with conn.cursor() as cur:
        cur.execute(get_idxs)
        idxs = cur.fetchall()
    cleaned_idxs = _clean_idxs(idxs)
    return cleaned_idxs