def from_json(self, json_text):
        """Deserialize a JSON object into this object.  This method will
        check that the JSON object has the required keys and will set each
        of the keys in that JSON object as an instance attribute of this
        object.

        :param json_text: the JSON text or object to deserialize from
        :type json_text: dict or string
        :raises ValueError: if the JSON object lacks an expected key
        :rtype: None"""

        #due to the architecture of response parsing, particularly
        #where the API returns lists, the JSON might have already been
        #parsed by the time it gets here
        if type(json_text) in [str, unicode]:
            j = json.loads(json_text)
        else:
            j = json_text

        try:
            for p in self.properties:
                setattr(self, p, j[p])
        except KeyError, e:
            msg = 'Expected key %s in JSON object, found None' % str(e)
            raise ValueError(msg)
dataset/ETHPy150Open tempodb/tempodb-python/tempodb/protocol/objects.py/JSONSerializable.from_json/original