code: def explode(expr, *args, **kwargs):
      
      if not isinstance(expr, Column):
          expr = to_collection(expr)[expr.name]
  
      if isinstance(expr, SequenceExpr):
          dtype = expr.data_type
      else:
          dtype = expr.value_type
  
      func_name = 'EXPLODE'
      if args and isinstance(args[0], (list, tuple, set)):
          names = list(args[0])
      else:
          names = args
      pos = kwargs.get('pos', False)
      if isinstance(expr, ListSequenceExpr):
          if pos:
              func_name = 'POSEXPLODE'
              typos = [df_types.int64, dtype.value_type]
              if not names:
                  names = [expr.name + '_pos', expr.name]
              if len(names) == 1:
                  names = [names[0] + '_pos', names[0]]
              if len(names) != 2:
                  raise ValueError("The length of parameter 'names' should be exactly 1.")
          else:
              typos = [dtype.value_type]
              if not names:
                  names = [expr.name]
              if len(names) != 1:
                  raise ValueError("The length of parameter 'names' should be exactly 1.")
      elif isinstance(expr, DictSequenceExpr):
          if pos:
              raise ValueError('Cannot support explosion with pos on dicts.')
          typos = [dtype.key_type, dtype.value_type]
          if not names:
              names = [expr.name + '_key', expr.name + '_value']
          if len(names) != 2:
              raise ValueError("The length of parameter 'names' should be exactly 2.")
      else:
          raise ValueError('Cannot explode expression with type %s' % type(expr).__name__)
      schema = Schema.from_lists(names, typos)
      return RowAppliedCollectionExpr(_input=expr.input, _func=func_name, _schema=schema,
                                      _fields=[expr], _keep_nulls=kwargs.get('keep_nulls', False))
docs: Expand list or dict data into multiple rows
  
      :param expr: list / dict sequence / scalar
      :return: