code: def get_time_index(X):
      """Get index of time series data, helper function.
  
      Parameters
      ----------
      X : pd.DataFrame, pd.Series, np.ndarray, or VectorizedDF
      in one of the following sktime mtype specifications for Series, Panel, Hierarchical:
      pd.DataFrame, pd.Series, np.ndarray, pd-multiindex, nested_univ, pd_multiindex_hier
      assumes all time series have equal length and equal index set
      will *not* work for list-of-df, pd-wide, pd-long, numpyflat
  
      Returns
      -------
      time_index : pandas.Index
          Index of time series
      """
      # assumes that all samples share the same the time index, only looks at
      # first row
      if isinstance(X, (pd.DataFrame, pd.Series)):
          # pd-multiindex or pd_multiindex_hier
          if isinstance(X.index, pd.MultiIndex):
              return X.loc[tuple(list(X.index[0])[:-1])].index
          # nested_univ
          elif isinstance(X, pd.DataFrame) and isinstance(
              X.iloc[0, 0], pd.DataFrame
          ):
              return _get_index(X.iloc[0, 0])
          # nested_univ
          elif isinstance(X, pd.DataFrame) and isinstance(
              X.iloc[0, 0], pd.Series
          ):
              return _get_index(X.iloc[0, 0])
          # pd.Series or pd.DataFrame
          else:
              return X.index
      # numpy3D and np.ndarray
      elif isinstance(X, np.ndarray):
          # np.ndarray
          if X.ndim < 3:
              return pd.RangeIndex(X.shape[0])
          # numpy3D
          else:
              return pd.RangeIndex(X.shape[-1])
      elif hasattr(X, "X"):
          return get_time_index(X.X)
      else:
          raise ValueError(
              f"X must be pd.DataFrame, pd.Series, or np.ndarray, but found: {type(X)}"
          )
  
file_path: sktime/sktime/datatypes/_utilities.py
imports: import numpy
  import pandas
label_desc: Use image node_id 2 for calling a global function with example usage: get_time_index(X) and returns: X, _get_index, pd, pd, get_time_index, _get_index, X