code: def _coerce_list_of_str(obj, var_name="obj"):
      """Check whether object is string or list of string.
  
      Parameters
      ----------
      obj - object to check
      var_name: str, optional, default="obj" - name of input in error messages
  
      Returns
      -------
      list of str
          equal to obj if was a list; equal to [obj] if obj was a str
          note: if obj was a list, return is not a copy, but identical
  
      Raises
      ------
      TypeError if obj is not a str or list of str
      """
      if isinstance(obj, str):
          obj = [obj]
      elif isinstance(obj, list):
          if not np.all([isinstance(x, str) for x in obj]):
              raise TypeError(
                  f"{var_name} must be a string or list of strings"
              )
      else:
          raise TypeError(
              f"{var_name} must be a string or list of strings"
          )
  
      return obj
  
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 2 for calling a global function with example usage: _coerce_list_of_str(obj, var_name) and returns: obj