def serialize(self, raw=False):
        '''Encode the private part of the key in a base64 format by default,
        but when raw is True it will return hex encoded bytes.
        @return: bytes
        '''
        if raw:
            return self._key.encode()
        return self._key.encode(nacl.encoding.Base64Encoder)
Encode the private part of the key in a base64 format by default,
        but when raw is True it will return hex encoded bytes.
        @return: bytes