def _set_attrs(self, attrs, allow_ro=False, from_json=True):
    """
    Sets all the attributes in the dictionary. Optionally, allows setting
    read-only attributes (e.g. when deserializing from JSON) and skipping
    JSON deserialization of values.
    """
    for k, v in attrs.iteritems():
      attr = self._check_attr(k, allow_ro)
      if attr and from_json:
        v = attr.from_json(self._get_resource_root(), v)
      object.__setattr__(self, k, v)
Sets all the attributes in the dictionary. Optionally, allows setting
    read-only attributes (e.g. when deserializing from JSON) and skipping
    JSON deserialization of values.