code: def _get_fields_and_offsets(dt, offset=0):
      """
      Returns a flat list of (dtype, count, offset) tuples of all the
      scalar fields in the dtype "dt", including nested fields, in left
      to right order.
      """
  
      # counts up elements in subarrays, including nested subarrays, and returns
      # base dtype and count
      def count_elem(dt):
          count = 1
          while dt.shape != ():
              for size in dt.shape:
                  count *= size
              dt = dt.base
          return dt, count
  
      fields = []
      for name in dt.names:
          field = dt.fields[name]
          f_dt, f_offset = field[0], field[1]
          f_dt, n = count_elem(f_dt)
  
          if f_dt.names is None:
              fields.append(
                  (np.dtype((f_dt, (n,))), n, f_offset + offset)
              )
          else:
              subfields = _get_fields_and_offsets(
                  f_dt, f_offset + offset
              )
              size = f_dt.itemsize
  
              for i in range(n):
                  if i == 0:
                      # optimization: avoid list comprehension if no subarray
                      fields.extend(subfields)
                  else:
                      fields.extend(
                          [
                              (d, c, o + i * size)
                              for d, c, o in subfields
                          ]
                      )
      return fields
  
imports: from __future__ import division, absolute_import, print_function
  import sys
  import itertools
  import numpy
  import numpy.ma
  from numpy import ndarray, recarray
  from numpy.ma import MaskedArray
  from numpy.ma.mrecords import MaskedRecords
  from numpy.core.overrides import array_function_dispatch
  from numpy.lib._iotools import _is_string_like
  from numpy.compat import basestring
  from numpy.testing import suppress_warnings
label_desc: Use image node_id 30 for calling a global function with example usage: _get_fields_and_offsets(dt, offset) and returns: fields, dt,  count