code: def flatten(seq):
      if isinstance(seq, list):
          results = []
          for item in seq:
              results.extend(flatten(item))
          return results
  
      if isinstance(seq, tuple):
          seq = list(seq)
          results = []
          for item in seq:
              results.extend(flatten(item))
          return results
  
      if isinstance(seq, dict):
          sorted_keys = sorted(seq.keys())
          result = []
          for key in sorted_keys:
              result.extend(flatten(seq[key]))
          return result
  
      return [seq]
  
file_path: analytics-zoo/pyzoo/zoo/util/nest.py
imports: import six
label_desc: Use image node_id 1 for calling a global function with example usage: flatten(seq) and returns: list, results, results, result