code: def base64(self, extras=()):
          
          s = self._marshal_json(extras=extras)
          s_bytes = s if isinstance(s, bytes) else s.encode('utf-8')
          b64enc = base64.b64encode(s_bytes)
          return b64enc.decode('utf-8') if isinstance(b64enc, bytes) else b64enc
docs: Encode json into base64.