docs: def read_micromanager_metadata(fh):
      """Read MicroManager non-TIFF settings from open file and return as dict.
  
      The settings can be used to read image data without parsing the TIFF file.
  
      Raise ValueError if the file does not contain valid MicroManager metadata.
  
      """
      fh.seek(0)
      try:
          byteorder = {b'II': '<', b'MM': '>'}[fh.read(2)]
      except IndexError:
          raise ValueError('not a MicroManager TIFF file')
  
      result = {}
      fh.seek(8)
      (index_header, index_offset, display_header, display_offset,
       comments_header, comments_offset, summary_header, summary_length
       ) = struct.unpack(byteorder + 'IIIIIIII', fh.read(32))
  
      if summary_header != 2355492:
          raise ValueError('invalid MicroManager summary header')
      result['Summary'] = read_json(fh, byteorder, None, summary_length, None)
  
      if index_header != 54773648:
          raise ValueError('invalid MicroManager index header')
      fh.seek(index_offset)
      header, count = struct.unpack(byteorder + 'II', fh.read(8))
      if header != 3453623:
          raise ValueError('invalid MicroManager index header')
      data = struct.unpack(byteorder + 'IIIII'*count, fh.read(20*count))
      result['IndexMap'] = {'Channel': data[::5],
                            'Slice': data[1::5],
                            'Frame': data[2::5],
                            'Position': data[3::5],
                            'Offset': data[4::5]}
  
      if display_header != 483765892:
          raise ValueError('invalid MicroManager display header')
      fh.seek(display_offset)
      header, count = struct.unpack(byteorder + 'II', fh.read(8))
      if header != 347834724:
          raise ValueError('invalid MicroManager display header')
      result['DisplaySettings'] = read_json(fh, byteorder, None, count, None)
  
      if comments_header != 99384722:
          raise ValueError('invalid MicroManager comments header')
      fh.seek(comments_offset)
      header, count = struct.unpack(byteorder + 'II', fh.read(8))
      if header != 84720485:
          raise ValueError('invalid MicroManager comments header')
      result['Comments'] = read_json(fh, byteorder, None, count, None)
  
      return result