docs: def read_fei_metadata(fh, byteorder, dtype, count, offsetsize):
      """Read FEI SFEG/HELIOS headers and return as dict."""
      result = {}
      section = {}
      data = bytes2str(stripnull(fh.read(count)))
      for line in data.splitlines():
          line = line.strip()
          if line.startswith('['):
              section = {}
              result[line[1:-1]] = section
              continue
          try:
              key, value = line.split('=')
          except ValueError:
              continue
          section[key] = astype(value)
      return result