code: def _validate_estimate_matrices(input_ems, all_ems):
      """Validate elements of `estimate_matrices`.
  
      Parameters
      ----------
      input_ems : str or list of str
          List of matrices names or "all"
      all_ems : List of str
          List of all legal parameters.
  
      Returns
      -------
          em_vars : list
              Legal parameters names
      """
      if isinstance(input_ems, str):
          if input_ems == "all":
              return all_ems
          if input_ems in all_ems:
              return list([input_ems])
  
          raise ValueError(
              f"If `estimate_matrices` is passed as a "
              f"string, "
              f"it must be `all` / one of: "
              f"{all_ems}, but found: "
              f"{input_ems}"
          )
  
      for em in input_ems:
          if em not in all_ems:
              raise ValueError(
                  f"Elements of `estimate_matrices` "
                  f"must be a subset of "
                  f"{all_ems}, but found: "
                  f"{em}"
              )
      return input_ems
  
imports: import numpy
  from sktime.transformations.base import BaseTransformer
  from sktime.utils.validation._dependencies import _check_soft_dependencies
  from sktime.utils.warnings import warn
label_desc: Use image node_id 5 for calling a global function with example usage: _validate_estimate_matrices(input_ems, all_ems) and returns: input_ems, all_ems, list