code: def flatten(obj):
      """Flatten nested list/tuple structure.
  
      Parameters
      ----------
      obj: nested list/tuple structure
  
      Returns
      -------
      list or tuple, tuple if obj was tuple, list otherwise
          flat iterable, containing non-list/tuple elements in obj in same order as in obj
  
      Example
      -------
      >>> flatten([1, 2, [3, (4, 5)], 6])
      [1, 2, 3, 4, 5, 6]
      """
      if not isinstance(obj, (list, tuple)):
          return [obj]
      else:
          return type(obj)([y for x in obj for y in flatten(x)])
  
imports: from inspect import isclass
  import numpy
  import pandas
  from sktime.base import BaseEstimator
label_desc: Use image node_id 1 for calling a global function with example usage: flatten(obj) and returns: list, type