def EncodeData(self, raw_text_data, encoding):
    """Encodes raw data into an armored form.

    Args:
      raw_text_data: Textual data to be encoded; should be in utf-8 form.
      encoding: Encoding to use (must be base64url)
    Raises:
      ValueError: The encoding is unknown or missing.
    Returns:
      The encoded data in the specified format.
    """
    if encoding != 'base64url':
      raise ValueError('Unknown encoding %s' % encoding)

    return base64.urlsafe_b64encode(
        unicode(raw_text_data).encode('utf-8')).encode('utf-8')
dataset/ETHPy150Open mimecuvalo/helloworld/packages/magicsig/__init__.py/MagicEnvelopeProtocol.EncodeData/original