def from_dict(cls, event: Dict[str, Any]) -> CloudEvent[DataType]:
        """Returns the deserialized CloudEvent object when a dict is provided.

        :param event: The dict representation of the event which needs to be deserialized.
        :type event: dict
        :rtype: CloudEvent
        :return: The deserialized CloudEvent object.
        """
        kwargs: Dict[str, Any] = {}
        reserved_attr = [
            "data",
            "data_base64",
            "id",
            "source",
            "type",
            "specversion",
            "time",
            "dataschema",
            "datacontenttype",
            "subject",
        ]

        if "data" in event and "data_base64" in event:
            raise ValueError("Invalid input. Only one of data and data_base64 must be present.")

        if "data" in event:
            data = event.get("data")
            kwargs["data"] = data if data is not None else NULL
        elif "data_base64" in event:
            kwargs["data"] = b64decode(cast(Union[str, bytes], event.get("data_base64")))

        for item in ["datacontenttype", "dataschema", "subject"]:
            if item in event:
                val = event.get(item)
                kwargs[item] = val if val is not None else NULL

        extensions = {k: v for k, v in event.items() if k not in reserved_attr}
        if extensions:
            kwargs["extensions"] = extensions

        try:
            event_obj = cls(
                id=event.get("id"),
                source=event["source"],
                type=event["type"],
                specversion=event.get("specversion"),
                time=_convert_to_isoformat(event.get("time")),
                **kwargs,
            )
        except KeyError as err:
            # https://github.com/cloudevents/spec Cloud event spec requires source, type,
            # specversion. We autopopulate everything other than source, type.
            # So we will assume the KeyError is coming from source/type access.
            if all(
                key in event
                for key in (
                    "subject",
                    "eventType",
                    "data",
                    "dataVersion",
                    "id",
                    "eventTime",
                )
            ):
                raise ValueError(
                    "The event you are trying to parse follows the Eventgrid Schema. You can parse"
                    + " EventGrid events using EventGridEvent.from_dict method in the azure-eventgrid library."
                ) from err
            raise ValueError(
                "The event does not conform to the cloud event spec https://github.com/cloudevents/spec."
                + " The `source` and `type` params are required."
            ) from err
        return event_obj
Returns the deserialized CloudEvent object when a dict is provided.

        :param event: The dict representation of the event which needs to be deserialized.
        :type event: dict
        :rtype: CloudEvent
        :return: The deserialized CloudEvent object.
        
Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/azure/core/messaging.py