code: def _check_list_of_str_or_error(arg_to_check, arg_name):
      """Check that certain arguments are str or list of str.
  
      Parameters
      ----------
      arg_to_check: argument we are testing the type of
      arg_name: str,
          name of the argument we are testing, will be added to the error if
          ``arg_to_check`` is not a str or a list of str
  
      Returns
      -------
      arg_to_check: list of str,
          if arg_to_check was originally a str it converts it into a list of str
          so that it can be iterated over.
  
      Raises
      ------
      TypeError if arg_to_check is not a str or list of str
      """
      # check that return_tags has the right type:
      if isinstance(arg_to_check, str):
          arg_to_check = [arg_to_check]
      if not isinstance(arg_to_check, list) or not all(
          isinstance(value, str) for value in arg_to_check
      ):
          raise TypeError(
              f"Error in all_estimators!  Argument {arg_name} must be either\
               a str or list of str"
          )
      return arg_to_check
  
file_path: sktime/sktime/registry/_lookup.py
imports: from copy import deepcopy
  from operator import itemgetter
  from pathlib import Path
  import pandas
  from skbase.lookup import all_objects
  from sktime.base import BaseEstimator
  from sktime.registry._base_classes import BASE_CLASS_LIST, BASE_CLASS_LOOKUP, TRANSFORMER_MIXIN_LIST
  from sktime.registry._tags import ESTIMATOR_TAG_REGISTER
label_desc: Use image node_id 2 for calling a global function with example usage: _check_list_of_str_or_error(arg_to_check, arg_name) and returns: arg_to_check