code: def scitype(
      obj,
      candidate_scitypes=SCITYPE_LIST,
      exclude_mtypes=AMBIGUOUS_MTYPES,
  ):
      """Infer the scitype of an object.
  
      Parameters
      ----------
      obj : object to infer type of - any type, should comply with some mtype spec
          if as_scitype is provided, this needs to be mtype belonging to scitype
      candidate_scitypes: str or list of str, scitypes to pick from
          valid scitype strings are in datatypes.SCITYPE_REGISTER
      exclude_mtypes : list of str, default = AMBIGUOUS_MTYPES
          which mtypes to ignore in inferring mtype, default = ambiguous ones
          valid mtype strings are in datatypes.MTYPE_REGISTER
  
      Returns
      -------
      str - the inferred sciype of "obj", a valid scitype string
              or None, if obj is None
          scitype strings with explanation are in datatypes.SCITYPE_REGISTER
  
      Raises
      ------
      TypeError if no type can be identified, or more than one type is identified
      """
      candidate_scitypes = _coerce_list_of_str(
          candidate_scitypes, var_name="candidate_scitypes"
      )
  
      valid_scitypes = []
  
      for scitype in candidate_scitypes:
          valid = check_is_scitype(
              obj,
              scitype=scitype,
              return_metadata=False,
              exclude_mtypes=exclude_mtypes,
          )
          if valid:
              valid_scitypes += [scitype]
  
      if len(valid_scitypes) > 1:
          raise TypeError(
              "Error in function scitype, more than one valid scitype identified:"
              f"{ valid_scitypes}"
          )
      if len(valid_scitypes) == 0:
          raise TypeError(
              "Error in function scitype, no valid scitype could be identified."
          )
  
      return valid_scitypes[0]
  
file_path: sktime/sktime/datatypes/_check.py
imports: from typing import List, Union
  import numpy
  from sktime.datatypes._alignment import check_dict_Alignment
  from sktime.datatypes._common import _metadata_requested, _ret
  from sktime.datatypes._hierarchical import check_dict_Hierarchical
  from sktime.datatypes._panel import check_dict_Panel
  from sktime.datatypes._proba import check_dict_Proba
  from sktime.datatypes._registry import AMBIGUOUS_MTYPES, SCITYPE_LIST, mtype_to_scitype
  from sktime.datatypes._series import check_dict_Series
  from sktime.datatypes._table import check_dict_Table
  from sktime.utils.warnings import warn
label_desc: Use image node_id 8 for calling a global function with example usage: scitype(obj, candidate_scitypes, exclude_mtypes) and returns: valid_scitypes