code: def name_to_code(category, name, language: str='und'):
      
      assert '/' not in language, "Language codes cannot contain slashes"
      assert '-' not in language, "This code should be reduced to a language subtag only"
      trie_name = '{}/name_to_{}'.format(language, category)
      if trie_name not in TRIES:
          TRIES[trie_name] = load_trie(data_filename('trie/{}.marisa'.format(trie_name)))
  
      trie = TRIES[trie_name]
      lookup = normalize_name(name)
      if lookup in trie:
          return get_trie_value(trie, lookup)
      else:
          # Is this a language plus extra junk? Maybe it has "...isch", "... language",
          # or "... Chinese" attached to it, for example.
          prefixes = trie.prefixes(lookup)
          if prefixes and len(prefixes[-1]) >= 4:
              return get_trie_value(trie, prefixes[-1])
          else:
              return None
docs: Get a language, script, or region by its name in some language.
  
      The language here must be a string representing a language subtag only.
      The `Language.find` method can handle other representations of a language
      and normalize them to this form.
  
      The default language, "und", will allow matching names in any language,
      so you can get the code 'fr' by looking up "French", "Français", or
      "francés".
  
      A small amount of fuzzy matching is supported: if the name can be
      shortened or lengthened to match a single language name, you get that
      language. This allows, for example, "Hakka Chinese" to match "Hakka".
  
      Occasionally, names are ambiguous in a way that can be resolved by
      specifying what name the language is supposed to be in. For example,
      there is a language named 'Malayo' in English, but it's different from
      the language named 'Malayo' in Spanish (which is Malay). Specifying the
      language will look up the name in a trie that is only in that language.