@classmethod
    def from_spec(cls, spec, context=None):
        cls.validate_spec(spec)
        try:
            return cls.constructor_map[spec['type']](spec, context)
        except (__HOLE__, BadValueError, WrappingAttributeError) as e:
            raise BadSpecError(_('Problem creating filter from spec: {}, message is {}').format(
                json.dumps(spec, indent=2),
                str(e),
            ))
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/userreports/filters/factory.py/FilterFactory.from_spec