code: def _generate_list_of_data_desc(data_shapes, data_types):
      """Convert list of tuples to list of DataDesc."""
  
      def flatten_list(arg):
          ret = []
          for el in arg:
              if isinstance(el, list):
                  ret += flatten_list(el)
              else:
                  ret.append(el)
          return ret
  
      flattened_data_types = flatten_list(data_types)
      flattened_data_shapes = flatten_list(data_shapes)
  
      if all(isinstance(x, DataDesc) for x in flattened_data_shapes):
          return data_shapes
  
      assert len(flattened_data_types) == len(flattened_data_shapes)
  
      # pass integral type as reference
      counter = [0]
  
      def get_data_desc(
          data_shape, counter=counter, data_types=flattened_data_types
      ):
          if isinstance(data_shape, DataDesc):
              return data_shape
          elif isinstance(data_shape, tuple):
              desc = DataDesc(
                  name="data" + str(counter[0]),
                  shape=data_shape,
                  dtype=data_types[counter[0]],
              )
              counter[0] += 1
              return desc
          else:
              raise ValueError(
                  "data_shapes must be either a list of DataDesc or a list of Tuple"
              )
  
      if len(data_shapes) == 1 and not isinstance(data_shapes[0], list):
          data_descs = [
              DataDesc(
                  name="data", shape=data_shapes[0], dtype=data_types[0]
              )
          ]
      else:
          data_descs = _multilist_iterator(data_shapes, get_data_desc)
  
      return data_descs
  
imports: import abc
  import ctypes
  import logging
  import os
  import warnings
  import numpy
  import mxnet
  from ..base import _LIB, check_call, py_str
  from ..base import c_array, c_str, mx_uint, mx_real_t, c_str_array
  from ..base import SymbolHandle
  from ..symbol import Symbol
  from ..None import ndarray
  from ..io import DataDesc
  from ..device import cpu, Device
  from ..util import is_np_array, wrap_ctx_to_device_func
label_desc: Use image node_id 6 for calling a global function with example usage: _generate_list_of_data_desc(data_shapes, data_types) and returns: data_descs, ret, data_shapes, data_shape, desc