code: def encode(self):
          
  
          blob = bytearray()
  
          for record in self.records:
              blob += record.encode()
  
          header = struct.pack("<LL", self.SCRIPT_MAGIC, len(blob) + self.SCRIPT_HEADER_LENGTH)
          blob = header + blob
  
          sha = hashlib.sha256()
          sha.update(blob)
          hash_value = sha.digest()[:16]
  
          return bytearray(hash_value) + blob
docs: Encode this record into a binary blob.
  
          This binary blob could be parsed via a call to FromBinary().
  
          Returns:
              bytearray: The binary encoded script.