code: def find_level_aliases():
      
      mapping = collections.defaultdict(list)
      for name, value in find_defined_levels().items():
          mapping[value].append(name)
      aliases = {}
      for value, names in mapping.items():
          if len(names) > 1:
              names = sorted(names, key=lambda n: len(n))
              canonical_name = names.pop()
              for alias in names:
                  aliases[alias] = canonical_name
      return aliases
docs: Find log level names which are aliases of each other.
  
      :returns: A dictionary that maps aliases to their canonical name.
  
      .. note:: Canonical names are chosen to be the alias with the longest
                string length so that e.g. ``WARN`` is an alias for ``WARNING``
                instead of the other way around.
  
      Here's what the result looks like by default (when
      no custom levels or level names have been defined):
  
      >>> from coloredlogs import find_level_aliases
      >>> find_level_aliases()
      {'WARN': 'WARNING', 'FATAL': 'CRITICAL'}