PyCrypto

AES works on blocks of 128 bits (16 bytes = 128 bits). In Electronic Code Book (EBC) mode it works by encrypting each block against the key. In Cipher Block Chaining (CBC) mode AES will encrypt each block with a previous block, using the key for the first block(s). The latter should be the more secure against known plaintext attacks, as EBC would potentially output the same bit pattern for each repeating set of characters in the plaintext – if that set of characters can be determined, so can the key and therefore the entire message could be decrypted by someone without the key.

Producing a set key length isn’t difficult, as we can simply take any password and generate a SHA256 digest for it:
Pass = raw_input('KEY: ')
encodedPass = hashlib.sha256(Pass).digest()
Another method of padding must be used for the text message, as SHA256 is non-reversible. The AES function only allows plaintext lengths that are multiples of 16 bytes. Each plaintext character happens to be a byte, and we can use string functions to round up a message to the nearst 16 characters.
message = raw_input('MESSAGE: ')
length = 16 - (len(message) % 16)
message += chr(length)*length
Here I have used ECB mode anyway. Because the algorithm shifts bits around, and not whole ASCII character bytes, the ciphertext is normally binary data that doesn’t translate well to ASCII, so I have added another line to give us Base64 output:
EncryptData = AES.new(encodedPass, AES.MODE_ECB)
ciphertext = EncryptData.encrypt(message)
print base64.b64encode(ciphertext)
To decrypt a message, we must use the same SHA256 value as before, so in turn the password must be the same for encrypting and decrypting the message.
Pass = raw_input('KEY: ')
encodedPass = hashlib.sha256(Pass).digest()
message = raw_input('CIPHERTEXT: ')
length = 16 - (len(message) % 16)
message += chr(length)*length
The padding sometimes causes the output to be appended with erroneous symbols, but the plaintext is still quite readable. If characters are missing, check that both encryption and decryption functions are using the same mode (CBC or EBC).
DecryptData = AES.new(encodedPass, AES.MODE_EBC)
plaintext = DecryptData.decrypt(base64.b64decode(message))
print plaintext