code: def get_level_index(df: pd.DataFrame, level=Union[str, int]) -> int:
      """
  
      get the level index of `df` given `level`
  
      Parameters
      ----------
      df : pd.DataFrame
          data
      level : Union[str, int]
          index level
  
      Returns
      -------
      int:
          The level index in the multiple index
      """
      if isinstance(level, str):
          try:
              return df.index.names.index(level)
          except (AttributeError, ValueError):
              # NOTE: If level index is not given in the data, the default level index will be ('datetime', 'instrument')
              return ("datetime", "instrument").index(level)
      elif isinstance(level, int):
          return level
      else:
          raise NotImplementedError(
              f"This type of input is not supported"
          )
  
file_path: qlib/qlib/data/dataset/utils.py
imports: from __future__ import annotations
  import pandas
  from typing import Union, List, TYPE_CHECKING
  from qlib.utils import init_instance_by_config
label_desc: Use image node_id 1 for calling a global function with example usage: get_level_index(df, level) and returns: df, level, str,  str