code: def map_metabolite2kegg(metabolite):
      logger.debug("Looking for KEGG compound identifier for %s.", metabolite.id)
      kegg_annotation = metabolite.annotation.get("kegg.compound")
      if kegg_annotation is None:
          logger.warning("No kegg.compound annotation for metabolite %s.",
                         metabolite.id)
          return
      if isinstance(kegg_annotation, string_types) and \
              kegg_annotation.startswith("C"):
          return kegg_annotation
      elif isinstance(kegg_annotation, Iterable):
          try:
              return get_smallest_compound_id(kegg_annotation)
          except ValueError:
              return
      logger.warning(
          "No matching kegg.compound annotation for metabolite %s.",
          metabolite.id
      )
      return