code: def _infer_effect_maps(second_level_input, contrast_def):
      """Deal with the different possibilities of second_level_input."""
      # Build the design matrix X and list of imgs Y for GLM fit
      if isinstance(second_level_input, pd.DataFrame):
          # If a Dataframe was given, we expect contrast_def to be in map_name
          def _is_contrast_def(x):
              return x["map_name"] == contrast_def
  
          is_con = second_level_input.apply(_is_contrast_def, axis=1)
          effect_maps = second_level_input[is_con][
              "effects_map_path"
          ].tolist()
  
      elif isinstance(second_level_input[0], FirstLevelModel):
          # Get the first level model maps
          effect_maps = []
          for model in second_level_input:
              effect_map = model.compute_contrast(
                  contrast_def, output_type="effect_size"
              )
              effect_maps.append(effect_map)
  
      else:
          effect_maps = second_level_input
  
      # check niimgs
      for niimg in effect_maps:
          check_niimg(niimg, ensure_ndim=3)
  
      return effect_maps
  
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 16 for calling a global function with example usage: _infer_effect_maps(second_level_input, contrast_def) and returns: effect_maps, unknown