docs: def read_VMP_modules(fileobj, read_module_data=True):
      """Reads in module headers in the VMPmodule_hdr format. Yields a dict with
      the headers and offset for each module.
  
      N.B. the offset yielded is the offset to the start of the data i.e. after
      the end of the header. The data runs from (offset) to (offset+length)"""
      while True:
          module_magic = fileobj.read(len(b'MODULE'))
          if len(module_magic) == 0:  # end of file
              raise StopIteration
          elif module_magic != b'MODULE':
              raise ValueError(
                  "Found %r, expecting start of new VMP MODULE" % module_magic)
  
          hdr_bytes = fileobj.read(VMPmodule_hdr.itemsize)
          if len(hdr_bytes) < VMPmodule_hdr.itemsize:
              raise IOError("Unexpected end of file while reading module header")
  
          hdr = np.fromstring(hdr_bytes, dtype=VMPmodule_hdr, count=1)
          hdr_dict = dict(((n, hdr[n][0]) for n in VMPmodule_hdr.names))
          print("---hdr-dict---")
          pprint(hdr_dict)
          hdr_dict['offset'] = fileobj.tell()
          if read_module_data:
              hdr_dict['data'] = fileobj.read(hdr_dict['length'])
              if len(hdr_dict['data']) != hdr_dict['length']:
                  raise IOError("""Unexpected end of file while reading data
                      current module: %s
                      length read: %d
                      length expected: %d""" % (hdr_dict['longname'],
                                                len(hdr_dict['data']),
                                                hdr_dict['length']))
              yield hdr_dict
          else:
              yield hdr_dict
              fileobj.seek(hdr_dict['offset'] + hdr_dict['length'], SEEK_SET)