code: def _check_input_type(second_level_input):
      """Determine the type of input provided."""
      if isinstance(second_level_input, pd.DataFrame):
          return "df_object"
      if isinstance(second_level_input, pd.Series):
          return "pd_series"
      if isinstance(second_level_input, (str, Nifti1Image)):
          return "nii_object"
      if isinstance(second_level_input, list):
          return _check_input_type_when_list(second_level_input)
      raise TypeError(
          "second_level_input must be "
          "either a pandas DataFrame, "
          "a Niimg-like object, "
          "a pandas Series of Niimg-like object, "
          "a list of Niimg-like object or "
          "a list of FirstLevelModel objects. "
          f"Got {_return_type(second_level_input)} instead"
      )
  
imports: import sys
  import time
  from warnings import warn
  import numpy
  import pandas
  from joblib import Memory
  from nibabel import Nifti1Image
  from sklearn.base import clone
  from nilearn._utils import fill_doc, stringify_path
  from nilearn._utils.niimg_conversions import check_niimg
  from nilearn.glm._base import BaseGLM
  from nilearn.glm.contrasts import compute_contrast, expression_to_contrast_vector
  from nilearn.glm.first_level import FirstLevelModel, run_glm
  from nilearn.glm.first_level.design_matrix import make_second_level_design_matrix
  from nilearn.glm.regression import RegressionResults, SimpleRegressionResults
  from nilearn.image import mean_img
  from nilearn.maskers import NiftiMasker
  from nilearn.mass_univariate import permuted_ols
label_desc: Use image node_id 2 for calling a global function with example usage: _check_input_type(second_level_input) and returns: str, str, str, _check_input_type_when_list