code: def encrypt(self, msg, alg='aes_128_cbc', padding='PKCS#7', b64enc=True,
                  block_size=AES_BLOCK_SIZE):
          
          self.__class__._deprecation_notice()
          if padding == 'PKCS#7':
              _block_size = block_size
          elif padding == 'PKCS#5':
              _block_size = 8
          else:
              _block_size = 0
  
          if _block_size:
              plen = _block_size - (len(msg) % _block_size)
              c = chr(plen).encode()
              msg += c * plen
  
          cipher, iv = self.build_cipher(alg)
          encryptor = cipher.encryptor()
          cmsg = iv + encryptor.update(msg) + encryptor.finalize()
  
          if b64enc:
              enc_msg = _base64.b64encode(cmsg)
          else:
              enc_msg = cmsg
  
          return enc_msg
docs: :param key: The encryption key
          :param msg: Message to be encrypted
          :param padding: Which padding that should be used
          :param b64enc: Whether the result should be base64encoded
          :param block_size: If PKCS#7 padding which block size to use
          :return: The encrypted message