def _generate_emoji_to_cat_tuple(category_odict):
    """category_odict is an ordered dict of categories to ordered dict of
    subcategories to lists of emoji sequences.  Returns a mapping from
    emoji sequence to a tuple of category, subcategory."""
    result = {}
    for cat, subcat_odict in category_odict.items():
      for subcat, emoji_sequences in subcat_odict.items():
        for emoji_sequence in emoji_sequences:
          result[emoji_sequence] = (cat, subcat)
    return result