@classmethod
    def loads(cls, data):
        def object_hook(d):
            if d.get('type') == 'SerializedFunction':
                return cls.loads(d['dump'])
            else:
                return d
        try:
            functions = json.loads(data, object_hook=object_hook)
        except Exception:
            # then it's just a simple path
            return cls(to_function(data))
        self = cls()
        for o in functions:
            f, kwargs = o['function'], o['kwargs']
            f = to_function(f)
            self.add(f, **kwargs)
        return self
dataset/ETHPy150Open dimagi/commcare-hq/corehq/ex-submodules/couchexport/util.py/SerializableFunction.loads/original