<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create(data, cipher, key, flags=0):
 """ Creates an EncryptedData message. @param data data to encrypt @param cipher cipher.CipherType object represening required cipher type @param key - byte array used as simmetic key @param flags - OR-ed combination of Flags constant """

        bio = Membio(data)
        ptr = libcrypto.CMS_EncryptedData_encrypt(bio.bio, cipher.cipher,
                                                  key, len(key), flags)
        if ptr is None:
            raise CMSError("encrypt data")
        return EncryptedData(ptr)