docs: def read_tvips_header(fh, byteorder, dtype, count, offsetsize):
      """Read TVIPS EM-MENU headers and return as dict."""
      result = {}
      header = fh.read_record(TIFF.TVIPS_HEADER_V1, byteorder=byteorder)
      for name, typestr in TIFF.TVIPS_HEADER_V1:
          result[name] = header[name].tolist()
      if header['Version'] == 2:
          header = fh.read_record(TIFF.TVIPS_HEADER_V2, byteorder=byteorder)
          if header['Magic'] != int(0xaaaaaaaa):
              log.warning('read_tvips_header: invalid TVIPS v2 magic number')
              return {}
          # decode utf16 strings
          for name, typestr in TIFF.TVIPS_HEADER_V2:
              if typestr.startswith('V'):
                  s = header[name].tostring().decode('utf16', errors='ignore')
                  result[name] = stripnull(s, null='\0')
              else:
                  result[name] = header[name].tolist()
          # convert nm to m
          for axis in 'XY':
              header['PhysicalPixelSize' + axis] /= 1e9
              header['PixelSize' + axis] /= 1e9
      elif header.version != 1:
          log.warning('read_tvips_header: unknown TVIPS header version')
          return {}
      return result