code: def mela_to_svara(
      mela: Union[str, int], *, abbr: bool = True, unicode: bool = True
  ) -> List[str]:
      """Spell the Carnatic svara names for a given melakarta raga
  
      This function exists to resolve enharmonic equivalences between
      pitch classes:
  
          - Ri2 / Ga1
          - Ri3 / Ga2
          - Dha2 / Ni1
          - Dha3 / Ni2
  
      For svara outside the raga, names are chosen to preserve orderings
      so that all Ri precede all Ga, and all Dha precede all Ni.
  
      Parameters
      ----------
      mela : str or int
          the name or numerical index of the melakarta raga
  
      abbr : bool
          If `True`, use single-letter svara names: S, R, G, ...
  
          If `False`, use full names: Sa, Ri, Ga, ...
  
      unicode : bool
          If `True`, use unicode symbols for numberings, e.g., Ri\u2081
  
          If `False`, use low-order ASCII, e.g., Ri1.
  
      Returns
      -------
      svara : list of strings
  
          The svara names for each of the 12 pitch classes.
  
      See Also
      --------
      key_to_notes
      mela_to_degrees
      list_mela
  
      Examples
      --------
      Melakarta #1 (Kanakangi) uses R1, G1, D1, N1
  
      >>> librosa.mela_to_svara(1)
      ['S', 'R₁', 'G₁', 'G₂', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'N₁', 'N₂', 'N₃']
  
      #19 (Jhankaradhwani) uses R2 and G2 so the third svara are Ri:
  
      >>> librosa.mela_to_svara(19)
      ['S', 'R₁', 'R₂', 'G₂', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'N₁', 'N₂', 'N₃']
  
      #31 (Yagapriya) uses R3 and G3, so third and fourth svara are Ri:
  
      >>> librosa.mela_to_svara(31)
      ['S', 'R₁', 'R₂', 'R₃', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'N₁', 'N₂', 'N₃']
  
      #34 (Vagadheeswari) uses D2 and N2, so Ni1 becomes Dha2:
  
      >>> librosa.mela_to_svara(34)
      ['S', 'R₁', 'R₂', 'R₃', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'D₂', 'N₂', 'N₃']
  
      #36 (Chalanatta) uses D3 and N3, so Ni2 becomes Dha3:
  
      >>> librosa.mela_to_svara(36)
      ['S', 'R₁', 'R₂', 'R₃', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'D₂', 'D₃', 'N₃']
  
      # You can also query by raga name instead of index:
  
      >>> librosa.mela_to_svara('chalanatta')
      ['S', 'R₁', 'R₂', 'R₃', 'G₃', 'M₁', 'M₂', 'P', 'D₁', 'D₂', 'D₃', 'N₃']
      """
      # The following will be constant for all ragas
      svara_map = [
          "Sa",
          "Ri\u2081",
          "",  # Ri2/Ga1
          "",  # Ri3/Ga2
          "Ga\u2083",
          "Ma\u2081",
          "Ma\u2082",
          "Pa",
          "Dha\u2081",
          "",  # Dha2/Ni1
          "",  # Dha3/Ni2
          "Ni\u2083",
      ]
  
      if isinstance(mela, str):
          mela_idx = MELAKARTA_MAP[mela.lower()] - 1
      elif 0 < mela <= 72:
          mela_idx = mela - 1
      else:
          raise ParameterError(f"mela={mela} must be in range [1, 72]")
  
      # Determine Ri2/Ga1
      lower = mela_idx % 36
      if lower < 6:
          # First six will have Ri1/Ga1
          svara_map[2] = "Ga\u2081"
      else:
          # All others have either Ga2/Ga3
          # So we'll call this Ri2
          svara_map[2] = "Ri\u2082"
  
      # Determine Ri3/Ga2
      if lower < 30:
          # First thirty should get Ga2
          svara_map[3] = "Ga\u2082"
      else:
          # Only the last six have Ri3
          svara_map[3] = "Ri\u2083"
  
      upper = mela_idx % 6
  
      # Determine Dha2/Ni1
      if upper == 0:
          # these are the only ones with Ni1
          svara_map[9] = "Ni\u2081"
      else:
          # Everyone else has Dha2
          svara_map[9] = "Dha\u2082"
  
      # Determine Dha3/Ni2
      if upper == 5:
          # This one has Dha3
          svara_map[10] = "Dha\u2083"
      else:
          # Everyone else has Ni2
          svara_map[10] = "Ni\u2082"
  
      if abbr:
          t_abbr = str.maketrans({"a": "", "h": "", "i": ""})
          svara_map = [s.translate(t_abbr) for s in svara_map]
  
      if not unicode:
          t_uni = str.maketrans(
              {"\u2081": "1", "\u2082": "2", "\u2083": "3"}
          )
          svara_map = [s.translate(t_uni) for s in svara_map]
  
      return list(svara_map)
  
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 3 for calling a global function with example usage: mela_to_svara(mela) and returns: list