def generic_encrypt(cipher_factory_map, plaintext, key, iv):
    """Encrypt data using the available backend.

    :param dict cipher_factory_map: Dictionary that maps the backend name to
        a cipher factory callable for that backend
    :param bytes plaintext: Plaintext data to encrypt
    :param bytes key: Encryption key
    :param bytes IV: Initialization vector
    :returns: Encrypted ciphertext
    :rtype: bytes
    """
    if backend is None:
        raise PysnmpCryptoError('Crypto backend not available')

    return _ENCRYPT_MAP[backend](cipher_factory_map[backend],
                                 plaintext, key, iv)
Encrypt data using the available backend.

    :param dict cipher_factory_map: Dictionary that maps the backend name to
        a cipher factory callable for that backend
    :param bytes plaintext: Plaintext data to encrypt
    :param bytes key: Encryption key
    :param bytes IV: Initialization vector
    :returns: Encrypted ciphertext
    :rtype: bytes