def METHOD_NAME(event_log_storage, print_fn=None):
    """Utility method to build an asset key index from the data in existing event log records.
    Takes in event_log_storage, and a print_fn to keep track of progress.
    """
    from dagster._core.definitions.events import AssetKey
    from dagster._core.storage.event_log.sql_event_log import SqlEventLogStorage
    from .schema import AssetKeyTable, SqlEventLogStorageTable
    if not isinstance(event_log_storage, SqlEventLogStorage):
        return
    query = (
        db_select([SqlEventLogStorageTable.c.asset_key])
        .where(SqlEventLogStorageTable.c.asset_key != None)  # noqa: E711
        .group_by(SqlEventLogStorageTable.c.asset_key)
    )
    with event_log_storage.index_connection() as conn:
        if print_fn:
            print_fn("Querying event logs.")
        to_insert = conn.execute(query).fetchall()
        if print_fn:
            print_fn(f"Found {len(to_insert)} records to index")
            to_insert = tqdm(to_insert)
        for (asset_key,) in to_insert:
            try:
                conn.execute(
                    AssetKeyTable.insert().values(
                        asset_key=AssetKey.from_db_string(asset_key).to_string()
                    )
                )
            except db.exc.IntegrityError:
                # asset key already present
                pass