def create_gene_name_dict(cursor, annot):
    """ Create a dictionary mapping TALON gene IDs to their names in the
        annot annotation"""

    cursor.execute("""SELECT ga.ID,
                             ga.value AS gene_name
                        FROM gene_annotations AS ga
                        WHERE ga.attribute = 'gene_name'
                        AND (ga.annot_name = '%s' OR ga.source = 'TALON')""" \
                        % (annot)) 

    gene_names = {}
    for entry in cursor.fetchall():
        ID = int(entry["ID"])
        name = entry["gene_name"]
        gene_names[ID] = name

    return gene_names