code: def serialize(self, as_private=None):
          
          if as_private is None:
              as_private = self.secret_exponent() is not None
          if self.secret_exponent() is None and as_private:
              raise PublicPrivateMismatchError("public key has no private parts")
  
          ba = bytearray()
          ba.extend([self._depth])
          ba.extend(self._parent_fingerprint + struct.pack(">L", self._child_index) + self._chain_code)
          if as_private:
              ba += b'\0' + self._secret_exponent_bytes
          else:
              ba += self.sec(is_compressed=True)
          return bytes(ba)
docs: Yield a 74-byte binary blob corresponding to this node.
          You must add a 4-byte prefix before converting to base58.