code: def flatten_dtype(ndtype, flatten_base=False):
      """
      Unpack a structured data-type by collapsing nested fields and/or fields
      with a shape.
  
      Note that the field names are lost.
  
      Parameters
      ----------
      ndtype : dtype
          The datatype to collapse
      flatten_base : bool, optional
         If True, transform a field with a shape into several fields. Default is
         False.
  
      Examples
      --------
      >>> dt = np.dtype([('name', 'S4'), ('x', float), ('y', float),
      ...                ('block', int, (2, 3))])
      >>> np.lib._iotools.flatten_dtype(dt)
      [dtype('S4'), dtype('float64'), dtype('float64'), dtype('int64')]
      >>> np.lib._iotools.flatten_dtype(dt, flatten_base=True)
      [dtype('S4'),
       dtype('float64'),
       dtype('float64'),
       dtype('int64'),
       dtype('int64'),
       dtype('int64'),
       dtype('int64'),
       dtype('int64'),
       dtype('int64')]
  
      """
      names = ndtype.names
      if names is None:
          if flatten_base:
              return [ndtype.base] * int(np.prod(ndtype.shape))
          return [ndtype.base]
      else:
          types = []
          for field in names:
              info = ndtype.fields[field]
              flat_dt = flatten_dtype(info[0], flatten_base)
              types.extend(flat_dt)
          return types
  
imports: import numpy
  import numpy._core.numeric
  from numpy._utils import asbytes, asunicode
label_desc: Use image node_id 5 for calling a global function with example usage: flatten_dtype(ndtype, flatten_base) and returns: list, types, unknown