def genes_by_alias(hgnc_genes):
alias_genes = {}<EOL>for hgnc_id in hgnc_genes:<EOL><INDENT>gene = hgnc_genes[hgnc_id]<EOL>hgnc_symbol = gene['<STR_LIT>']<EOL>for alias in gene['<STR_LIT>']:<EOL><INDENT>true_id = None<EOL>if alias == hgnc_symbol:<EOL><INDENT>true_id = hgnc_id<EOL><DEDENT>if alias in alias_genes:<EOL><INDENT>alias_genes[alias.upper()]['<STR_LIT>'].add(hgnc_id)<EOL>if true_id:<EOL><INDENT>alias_genes[alias.upper()]['<STR_LIT>'] = hgnc_id<EOL><DEDENT><DEDENT>else:<EOL><INDENT>alias_genes[alias.upper()] = {<EOL>'<STR_LIT:true>': true_id,<EOL>'<STR_LIT>': set([hgnc_id])<EOL>}<EOL><DEDENT><DEDENT><DEDENT>return alias_genes<EOL>
Return a dictionary with hgnc symbols as keys

    Value of the dictionaries are information about the hgnc ids for a symbol.
    If the symbol is primary for a gene then 'true_id' will exist.
    A list of hgnc ids that the symbol points to is in ids.

    Args:
        hgnc_genes(dict): a dictionary with hgnc_id as key and gene info as value

    Returns:
        alias_genes(dict):
            {
                'hgnc_symbol':{
                    'true_id': int,
                    'ids': list(int)
                    }
            }