<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def encrypt_attribute(attribute_name, attribute, encryption_key, algorithm):
 # type: (Text, dynamodb_types.RAW_ATTRIBUTE, DelegatedKey, Text) -> dynamodb_types.BINARY_ATTRIBUTE """Encrypt a single DynamoDB attribute. :param str attribute_name: DynamoDB attribute name :param dict attribute: Plaintext DynamoDB attribute :param DelegatedKey encryption_key: DelegatedKey to use to encrypt the attribute :param str algorithm: Encryption algorithm descriptor (passed to encryption_key as algorithm) :returns: Encrypted DynamoDB binary attribute :rtype: dict """

    serialized_attribute = serialize_attribute(attribute)
    encrypted_attribute = encryption_key.encrypt(
        algorithm=algorithm, name=attribute_name, plaintext=serialized_attribute
    )
    return {Tag.BINARY.dynamodb_tag: encrypted_attribute}