def deserialize_rfc(attr):
        """Deserialize RFC-1123 formatted string into Datetime object.

        :param str attr: response string to be deserialized.
        :rtype: Datetime
        :raises: DeserializationError if string format invalid.
        """
        if isinstance(attr, ET.Element):
            attr = attr.text
        try:
            date_obj = datetime.datetime.strptime(
                attr, "%a, %d %b %Y %H:%M:%S %Z")
            if not date_obj.tzinfo:
                date_obj = date_obj.replace(tzinfo=TZ_UTC)
        except ValueError as err:
            msg = "Cannot deserialize to rfc datetime object."
            raise_with_traceback(DeserializationError, msg, err)
        else:
            return date_obj
def deserialize_rfc ( attr ) : if isinstance ( attr , ET . Element ) : attr = attr . text try : date_obj = datetime . datetime . strptime ( attr , "%a, %d %b %Y %H:%M:%S %Z" ) if not date_obj . tzinfo : date_obj = date_obj . replace ( tzinfo = TZ_UTC ) except ValueError as err : msg = "Cannot deserialize to rfc datetime object." raise_with_traceback ( DeserializationError , msg , err ) else : return date_obj
Deserialize RFC-1123 formatted string into Datetime object.

        :param str attr: response string to be deserialized.
        :rtype: Datetime
        :raises: DeserializationError if string format invalid.