code: def encode_aes256(key, plaintext):
      
      if len(key) != 64:
          raise TypeError("encode_aes256() expects a 256 bit key encoded as a 64 hex character string")
  
      # generate AES.block_size cryptographically secure random bytes for our IV (initial value)
      iv = os.urandom(AES.block_size)
      # set up an AES cipher object
      cipher = AES.new(binascii.unhexlify(key.encode('ascii')), mode=AES.MODE_CBC, IV=iv)
      # encrypt the plaintext after padding it
      ciphertext = cipher.encrypt(ensure_bytes(pad_aes256(plaintext)))
      # append the hexed IV and the hexed ciphertext
      iv_plus_encrypted = binascii.hexlify(iv) + binascii.hexlify(ciphertext)
      # return that
      return iv_plus_encrypted
docs: 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 hex string key and converts it to a 256 bit binary blob. Then pads the given
      plaintext to AES block size which is always 16 bytes, regardless of AES key 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, 64 hex chars long
      :param plaintext: string, any amount of data