docs: def parse_kegg_gene_metadata(infile):
      """Parse the KEGG flatfile and return a dictionary of metadata.
  
      Dictionary keys are:
          refseq
          uniprot
          pdbs
          taxonomy
  
      Args:
          infile: Path to KEGG flatfile
  
      Returns:
          dict: Dictionary of metadata
  
      """
      metadata = defaultdict(str)
  
      with open(infile) as mf:
          kegg_parsed = bs_kegg.parse(mf.read())
  
      # TODO: additional fields can be parsed
  
      if 'DBLINKS' in kegg_parsed.keys():
          if 'UniProt' in kegg_parsed['DBLINKS']:
              unis = str(kegg_parsed['DBLINKS']['UniProt']).split(' ')
              # TODO: losing other uniprot ids by doing this
              if isinstance(unis, list):
                  metadata['uniprot'] = unis[0]
              else:
                  metadata['uniprot'] = unis
          if 'NCBI-ProteinID' in kegg_parsed['DBLINKS']:
              metadata['refseq'] = str(kegg_parsed['DBLINKS']['NCBI-ProteinID'])
      if 'STRUCTURE' in kegg_parsed.keys():
          metadata['pdbs'] = str(kegg_parsed['STRUCTURE']['PDB']).split(' ')
      else:
          metadata['pdbs'] = None
      if 'ORGANISM' in kegg_parsed.keys():
          metadata['taxonomy'] = str(kegg_parsed['ORGANISM'])
  
      return metadata