docs: def read_lsm_scaninfo(fh):
      """Read LSM ScanInfo structure from file and return as dict."""
      block = {}
      blocks = [block]
      unpack = struct.unpack
      if struct.unpack('<I', fh.read(4))[0] != 0x10000000:
          # not a Recording sub block
          log.warning('read_lsm_scaninfo: invalid LSM ScanInfo structure')
          return block
      fh.read(8)
      while True:
          entry, dtype, size = unpack('<III', fh.read(12))
          if dtype == 2:
              # ascii
              value = bytes2str(stripnull(fh.read(size)))
          elif dtype == 4:
              # long
              value = unpack('<i', fh.read(4))[0]
          elif dtype == 5:
              # rational
              value = unpack('<d', fh.read(8))[0]
          else:
              value = 0
          if entry in TIFF.CZ_LSMINFO_SCANINFO_ARRAYS:
              blocks.append(block)
              name = TIFF.CZ_LSMINFO_SCANINFO_ARRAYS[entry]
              newobj = []
              block[name] = newobj
              block = newobj
          elif entry in TIFF.CZ_LSMINFO_SCANINFO_STRUCTS:
              blocks.append(block)
              newobj = {}
              block.append(newobj)
              block = newobj
          elif entry in TIFF.CZ_LSMINFO_SCANINFO_ATTRIBUTES:
              name = TIFF.CZ_LSMINFO_SCANINFO_ATTRIBUTES[entry]
              block[name] = value
          elif entry == 0xffffffff:
              # end sub block
              block = blocks.pop()
          else:
              # unknown entry
              block['Entry0x%x' % entry] = value
          if not blocks:
              break
      return block