code: def check_is_scitype(
      obj,
      scitype: Union[str, List[str]],
      return_metadata=False,
      var_name="obj",
      exclude_mtypes=AMBIGUOUS_MTYPES,
  ):
      """Check object for compliance with scitype specification, return metadata.
  
      Parameters
      ----------
      obj - object to check
      scitype: str or list of str, scitype to check obj as
          valid mtype strings are in datatypes.SCITYPE_REGISTER
      return_metadata - bool, optional, default=False
          if False, returns only "valid" return
          if True, returns all three return objects
          if str, list of str, metadata return dict is subset to keys in return_metadata
      var_name: str, optional, default="obj" - name of input in error messages
      exclude_mtypes : list of str, default = AMBIGUOUS_MTYPES
          which mtypes to ignore in inferring mtype, default = ambiguous ones
  
      Returns
      -------
      valid: bool - whether obj is a valid object of mtype/scitype
      msg: dict[str, str] or None
          error messages if object is not valid, otherwise None
          keys are all mtypes tested, value for key is error message for that key
      metadata: dict - metadata about obj if valid, otherwise None
              returned only if return_metadata is True
          Fields depend on scitpe.
          Always returned:
              "mtype": str, mtype of obj (assumed or inferred)
                  mtype strings with explanation are in datatypes.MTYPE_REGISTER
              "scitype": str, scitype of obj (assumed or inferred)
                  scitype strings with explanation are in datatypes.SCITYPE_REGISTER
          For scitype "Series":
              "is_univariate": bool, True iff series has one variable
              "is_equally_spaced": bool, True iff series index is equally spaced
              "is_empty": bool, True iff series has no variables or no instances
              "has_nans": bool, True iff the series contains NaN values
          For scitype "Panel":
              "is_univariate": bool, True iff all series in panel have one variable
              "is_equally_spaced": bool, True iff all series indices are equally spaced
              "is_equal_length": bool, True iff all series in panel are of equal length
              "is_empty": bool, True iff one or more of the series in the panel are empty
              "is_one_series": bool, True iff there is only one series in the panel
              "has_nans": bool, True iff the panel contains NaN values
              "n_instances": int, number of instances in the panel
          For scitype "Table":
              "is_univariate": bool, True iff table has one variable
              "is_empty": bool, True iff table has no variables or no instances
              "has_nans": bool, True iff the panel contains NaN values
          For scitype "Alignment":
              currently none
      Raises
      ------
      TypeError if scitype input argument is not of expected type
      """
      scitype = _coerce_list_of_str(scitype, var_name="scitype")
  
      for x in scitype:
          _check_scitype_valid(x)
  
      valid_keys = check_dict.keys()
  
      # find all the mtype keys corresponding to the scitypes
      keys = [
          x
          for x in valid_keys
          if x[1] in scitype and x[0] not in exclude_mtypes
      ]
  
      # storing the msg return
      msg = {}
      found_mtype = []
      found_scitype = []
  
      for key in keys:
          res = check_dict[key](
              obj, return_metadata=return_metadata, var_name=var_name
          )
  
          if _metadata_requested(return_metadata):
              check_passed = res[0]
          else:
              check_passed = res
  
          if check_passed:
              final_result = res
              found_mtype.append(key[0])
              found_scitype.append(key[1])
          elif _metadata_requested(return_metadata):
              msg[key[0]] = res[1]
  
      # there are three options on the result of check_is_mtype:
      # a. two or more mtypes are found - this is unexpected and an error with checks
      if len(found_mtype) > 1:
          raise TypeError(
              f"Error in check_is_mtype, more than one mtype identified: {found_mtype}"
          )
      # b. one mtype is found - then return that mtype
      elif len(found_mtype) == 1:
          if _metadata_requested(return_metadata):
              # add the mtype return to the metadata
              final_result[2]["mtype"] = found_mtype[0]
              # add the scitype return to the metadata
              final_result[2]["scitype"] = found_scitype[0]
              # final_result already has right shape and dependency on return_metadata
              return final_result
          else:
              return True
      # c. no mtype is found - then return False and all error messages if requested
      else:
          return _ret(False, msg, None, return_metadata)
  
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 6 for calling a global function with example usage: check_is_scitype(obj, scitype, return_metadata, var_name, exclude_mtypes) and returns: _ret, final_result, True