'Encrypts plaintext into ciphertext by using a customer master
key.
:type key_id: string
:param key_id: Unique identifier of the customer master. This can be an
ARN, an alias, or the Key ID.
:type plaintext: blob
:param plaintext: Data to be encrypted.
:type encryption_context: map
:param encryption_context: Name:value pair that specifies the
encryption context to be used for authenticated encryption. For
more information, see `Authenticated Encryption`_.
:type grant_tokens: list
:param grant_tokens: A list of grant tokens that represent grants which
can be used to provide long term permissions to perform encryption.'

def encrypt(self, key_id, plaintext, encryption_context=None, grant_tokens=None):

    if (not isinstance(plaintext, six.binary_type)):
        raise TypeError(('Value    of    argument    ``plaintext``    must    be    of    type    %s.' % six.binary_type))
    plaintext = base64.b64encode(plaintext)
    params = {'KeyId': key_id, 'Plaintext': plaintext.decode('utf-8')}
    if (encryption_context is not None):
        params['EncryptionContext'] = encryption_context
    if (grant_tokens is not None):
        params['GrantTokens'] = grant_tokens
    response = self.make_request(action='Encrypt', body=json.dumps(params))
    if (response.get('CiphertextBlob') is not None):
        response['CiphertextBlob'] = base64.b64decode(response['CiphertextBlob'].encode('utf-8'))
    return response
