code: def __mode_to_key(signature: str, unicode: bool = True) -> str:
      """Translate a mode (eg D:dorian) into its equivalent major key. If unicode==True, return the accidentals as unicode symbols, regardless of nature of accidentals in signature. Otherwise, return accidentals as ASCII symbols.
  
      >>> librosa.__mode_to_key('Db:loc')
      'E𝄫:maj'
  
      >>> librosa.__mode_to_key('D♭:loc', unicode = False)
      'Ebb:maj'
  
      """
      match = KEY_RE.match(signature)
  
      if not match:
          raise ParameterError(
              "Improper format: {:s}".format(signature)
          )
  
      if match.group("scale") or not match.group("mode"):
          # We're already fine here, but let's pass the key through __simpify_note() to ensure good formatting.
          signature = __simplify_note(
              match.group("tonic").upper() + match.group("accidental"),
              unicode=unicode,
          ) + (
              ":" + match.group("scale") if match.group("scale") else ""
          )
          return signature
  
      # We have a mode, time to translate
      mode = match.group("mode").lower()[:3]
  
      # Get the relative major
      tonic = MAJOR_DICT[mode][match.group("tonic").upper()]
  
      return (
          __simplify_note(
              tonic + match.group("accidental"), unicode=unicode
          )
          + ":maj"
      )
  
imports: import re
  import numpy
  from numba import jit
  from collections import Counter
  from .intervals import INTERVALS
  from .._cache import cache
  from ..util.exceptions import ParameterError
  from typing import Dict, List, Iterable, Union, overload
  from ..util.decorators import vectorize
  from .._typing import _ScalarOrSequence, _FloatLike_co, _SequenceLike, _IterableLike
label_desc: Use image node_id 14 for calling a global function with example usage: __mode_to_key(signature, unicode) and returns: unknown, signature