code: def hash_for_signing(self, msg):
          
          magic = self.msg_magic_for_netcode()
  
          fd = io.BytesIO()
          stream_satoshi_string(fd, magic.encode('utf8'))
          stream_satoshi_string(fd, msg.encode('utf8'))
  
          # return as a number, since it's an input to signing algos like that anyway
          return from_bytes_32(double_sha256(fd.getvalue()))
docs: Return a hash of msg, according to odd bitcoin method: double SHA256 over a bitcoin
          encoded stream of two strings: a fixed magic prefix and the actual message.