def old_encode_aes(key, plaintext):
    """
    Utility method to encode some given plaintext with the given key. Important thing to note:

    This is not a general purpose encryption method - it has specific semantics (see below for
    details).

    Takes the given key, pads it to 32 bytes. Then takes the given plaintext and pads that to a
    32 byte block size. Then encrypts using AES-256-CBC using a random IV. Then converts both the
    IV and the ciphertext to hex. Finally returns the IV appended by the ciphertext.

    :param key: string, <= 32 bytes long
    :param plaintext: string, any amount of data
    """
    # generate 16 cryptographically secure random bytes for our IV (initial value)
    iv = os.urandom(16)
    # set up an AES cipher object
    cipher = AES.new(ensure_bytes(old_pad(key)), mode=AES.MODE_CBC, IV=iv)
    # encrypte the plaintext after padding it
    ciphertext = cipher.encrypt(ensure_bytes(old_pad(plaintext)))
    # append the hexed IV and the hexed ciphertext
    iv_plus_encrypted = binascii.hexlify(iv) + binascii.hexlify(ciphertext)
    # return that
    return iv_plus_encrypted