code: def init_aes(shared_secret, nonce):
      
      " Shared Secret "
      ss = hashlib.sha512(unhexlify(shared_secret)).digest()
      " Seed "
      seed = bytes(str(nonce), "ascii") + hexlify(ss)
      seed_digest = hexlify(hashlib.sha512(seed).digest()).decode("ascii")
      " AES "
      key = unhexlify(seed_digest[0:64])
      iv = unhexlify(seed_digest[64:96])
      return AES.new(key, AES.MODE_CBC, iv)
docs: Initialize AES instance
  
          :param hex shared_secret: Shared Secret to use as encryption key
          :param int nonce: Random nonce
          :return: AES instance
          :rtype: AES