def get_or_new_from_json_dict(data, cls):
        """Get `cls` object w/ deserialization from json if needed.

        If data is instance of cls, return data.
        Else if data is instance of dict, create instance from dict.
        Else, return None.

        :param data:
        :param cls:
        :rtype: object
        :return:
        """
        if isinstance(data, cls):
            return data
        elif isinstance(data, dict):
            return cls.new_from_json_dict(data)

        return None
def get_or_new_from_json_dict ( data , cls ) : if isinstance ( data , cls ) : return data elif isinstance ( data , dict ) : return cls . new_from_json_dict ( data ) return None
Get `cls` object w/ deserialization from json if needed.

        If data is instance of cls, return data.
        Else if data is instance of dict, create instance from dict.
        Else, return None.

        :param data:
        :param cls:
        :rtype: object
        :return: