code: def mela_to_degrees(mela: Union[str, int]) -> np.ndarray:
      """Construct the svara indices (degrees) for a given melakarta raga
  
      Parameters
      ----------
      mela : str or int
          Either the name or integer index ([1, 2, ..., 72]) of the melakarta raga
  
      Returns
      -------
      degrees : np.ndarray
          A list of the seven svara indices (starting from 0=Sa)
          contained in the specified raga
  
      See Also
      --------
      thaat_to_degrees
      key_to_degrees
      list_mela
  
      Examples
      --------
      Melakarta #1 (kanakangi):
  
      >>> librosa.mela_to_degrees(1)
      array([0, 1, 2, 5, 7, 8, 9])
  
      Or using a name directly:
  
      >>> librosa.mela_to_degrees('kanakangi')
      array([0, 1, 2, 5, 7, 8, 9])
      """
      if isinstance(mela, str):
          index = MELAKARTA_MAP[mela.lower()] - 1
      elif 0 < mela <= 72:
          index = mela - 1
      else:
          raise ParameterError(f"mela={mela} must be in range [1, 72]")
  
      # always have Sa [0]
      degrees = [0]
  
      # Fill in Ri and Ga
      lower = index % 36
      if 0 <= lower < 6:
          # Ri1, Ga1
          degrees.extend([1, 2])
      elif 6 <= lower < 12:
          # Ri1, Ga2
          degrees.extend([1, 3])
      elif 12 <= lower < 18:
          # Ri1, Ga3
          degrees.extend([1, 4])
      elif 18 <= lower < 24:
          # Ri2, Ga2
          degrees.extend([2, 3])
      elif 24 <= lower < 30:
          # Ri2, Ga3
          degrees.extend([2, 4])
      else:
          # Ri3, Ga3
          degrees.extend([3, 4])
  
      # Determine Ma
      if index < 36:
          # Ma1
          degrees.append(5)
      else:
          # Ma2
          degrees.append(6)
  
      # always have Pa [7]
      degrees.append(7)
  
      # Determine Dha and Ni
      upper = index % 6
      if upper == 0:
          # Dha1, Ni1
          degrees.extend([8, 9])
      elif upper == 1:
          # Dha1, Ni2
          degrees.extend([8, 10])
      elif upper == 2:
          # Dha1, Ni3
          degrees.extend([8, 11])
      elif upper == 3:
          # Dha2, Ni2
          degrees.extend([9, 10])
      elif upper == 4:
          # Dha2, Ni3
          degrees.extend([9, 11])
      else:
          # Dha3, Ni3
          degrees.extend([10, 11])
  
      return np.array(degrees)
  
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 2 for calling a global function with example usage: mela_to_degrees(mela) and returns: np