code: def aes_cbc_encrypt_data(symkey, iv, data, pad):
      # type: (bytes, bytes, bytes, bool) -> bytes
      
      cipher = cryptography.hazmat.primitives.ciphers.Cipher(
          cryptography.hazmat.primitives.ciphers.algorithms.AES(symkey),
          cryptography.hazmat.primitives.ciphers.modes.CBC(iv),
          backend=cryptography.hazmat.backends.default_backend()).encryptor()
      if pad:
          return cipher.update(pkcs7_pad(data)) + cipher.finalize()
      else:
          return cipher.update(data) + cipher.finalize()
docs: Encrypt data using AES CBC
      :param bytes symkey: symmetric key
      :param bytes iv: initialization vector
      :param bytes data: data to encrypt
      :param bool pad: pad data
      :rtype: bytes
      :return: encrypted data