def ecb_encrypt(message, key):
    """ Encrypts a message in AES ECB mode with a given key
    ACCEPTS: Two strings, the plaintext message and the key
    RETURNS: A bytes string of base64 encoded ciphertext
    """
aes = AES.new(key, AES.MODE_ECB)
return base64.b64encode(aes.encrypt(message)).decode()

def ecb_decrypt(encrypted, key):
    """ Decrypts a ciphertext in AES ECB mode with a given key
    ACCEPTS: Two strings, the base64 encoded ciphertext and the key
    RETURNS: A bytes string of the plaintext message
    """
aes = AES.new(key, AES.MODE_ECB)
return aes.decrypt(base64.b64decode(encrypted))
if __name__ == '__main__':
    Key = '0000000000000000'
plain_text = '1010101110101011'
cipher_text = ecb_encrypt(plain_text, Key)
decrypted_pt = ecb_decrypt(cipher_text, Key).decode()
print('Original message: {}'.format(plain_text))
print('Encrypted message: {}'.format(cipher_text))
print('Decrypted message: {}'.format(decrypted_pt))
encrypt a binary data into binary and also decrypt