@classmethod
def by_json(cls, data, read_only=False, **kw):
    """ Creates a new instance and calls from_json on the instance.

            Will take kwargs and pass to the underlying instance
            initializer.

            :param class cls: Class method is running on
            :param str data: JSON string to create object from
            :param bool read_only: Set object read-only
            :param dict **kw: Object initializer options
            :rtype: cls
            :returns: new BrineObject subclass instance
        """
    inst = cls(**kw)
    inst.from_json(data)
    if read_only:
        inst.read_only()
    return inst
