def aes_encrypt(mode, aes_key, aes_iv, *data):
encryptor = Cipher(<EOL>algorithms.AES(aes_key),<EOL>mode(aes_iv),<EOL>backend=default_backend()).encryptor()<EOL>result = None<EOL>for value in data:<EOL><INDENT>result = encryptor.update(value)<EOL><DEDENT>encryptor.finalize()<EOL>return result, None if not hasattr(encryptor, '<STR_LIT>') else encryptor.tag<EOL>
Encrypt data with AES in specified mode.