code: def get_signature_data(fileobj, filesize):
      
      # Read everything except the signature entries
      # The first 8 bytes are covered, as is everything from the beginning
      # of the additional section to the end of the file. The signature
      # algorithm id and size fields are also covered.
  
      fileobj.seek(0)
      marfile = mar.parse_stream(fileobj)
      if not marfile.signatures:
          raise IOError("Can't generate signature data for file without signature blocks")
  
      # MAR header
      fileobj.seek(0)
      block = fileobj.read(8)
      yield block
  
      # Signatures header
      sigs = sigs_header.parse_stream(fileobj)
  
      sig_types = [(sig.algorithm_id, sig.size) for sig in sigs.sigs]
  
      block = Int64ub.build(filesize) + Int32ub.build(sigs.count)
      yield block
  
      # Signature algorithm id and size per entry
      for algorithm_id, size in sig_types:
          block = Int32ub.build(algorithm_id) + Int32ub.build(size)
          yield block
  
      # Everything else in the file is covered
      for block in file_iter(fileobj):
          yield block
docs: Read data from MAR file that is required for MAR signatures.
  
      Args:
          fileboj (file-like object): file-like object to read the MAR data from
          filesize (int): the total size of the file
  
      Yields:
          blocks of bytes representing the data required to generate or validate
          signatures.