code: def check_groups(groups):
      # treating groups as list simplifies code
      if groups is not None and not isinstance(
          groups, (str, list, np.ndarray, pd.Series)
      ):
          raise TypeError(
              "groups must be str or list or numpy.ndarray or pandas.Series or None"
          )
  
      if groups is None:
          groups_ = []
      elif isinstance(groups, str):
          groups_ = [groups]
      else:
          groups_ = list(groups)
  
      return groups_
  
imports: import numpy
  import pandas
label_desc: Use image node_id 3 for calling a global function with example usage: check_groups(groups) and returns: groups_