class_docstr: Step that reduces a dimension instead of manually looping on it.
  
  Using this step is equivalent to doing `sum(dact_data, [])` for each dact_data
  that might be a IDT, DIT, or EOT of a DACT (DAtaConTainer) to flatten the data,
  then the data is by default unflattened at the end of the loop in _did_process.
class_docstr_tok: ["Step","that","reduces","a","dimension","instead","of","manually","looping","on","it",".","Using","this","step","is","equivalent","to","doing","`","sum","(","dact_data",",","[","]",")","`","for","each","dact_data","that","might","be","a","IDT",",","DIT",",","or","EOT","of","a","DACT","(","DAtaConTainer",")","to","flatten","the","data",",","then","the","data","is","by","default","unflattened","at","the","end","of","the","loop","in","_did_process","."]
docstr: Flatten the first dimension of a list.
  
  :param list_to_flatten: list to flatten
  :return: flattened list, len flattened lists
code: def _flatten_list(
      self, _data: Union[Optional[DACTData], List[DACTData]]
  ) -> Tuple[Optional[DACTData], List[lens]]:
      """
      Flatten the first dimension of a list.
  
      :param list_to_flatten: list to flatten
      :return: flattened list, len flattened lists
      """
      if _data is None or all(v is None for v in _data):
          return None, []
  
      if len(_data) != 0:
          try:
              iter(_data)
          except TypeError:
              return _data, [1 for x in _data]
  
      _data = [list(x) for x in _data]
      len_list_to_flatten = [len(x) for x in _data]
      flattened_list = sum(_data, [])
  
      return flattened_list, len_list_to_flatten
  
imports: import copy
  from operator import itemgetter
  from typing import Callable, List, Optional, Tuple, Union
  from neuraxle.base import CX, DACT, BaseStep, BaseTransformer, ForceHandleMixin, ForceHandleOnlyMixin, Identity, MetaStep, NamedStepsList, TruncableJoblibStepSaver
  from neuraxle.data_container import DIT, EOT, IDT, DACTData, ListDataContainer
  from neuraxle.steps.flow import ExecuteIf
  import numpy
label_desc: Use image node_id 3 for calling the FlattenForEach obj's underlying member method code with example usage: obj._flatten_list(_data) and returns: flattened_list,  len_list_to_flatten, None,  list, _data,  unknown