def METHOD_NAME(self, decl, args, kwargs):
    if decl == '.SUBCKT':
        self._constraints = []
        name = args.pop(0)
        assert not isinstance(self.library.find(name), SubCircuit), f"User is attempting to redeclare subcircuit {name}"
        with set_context(self.library):
            subckt = SubCircuit(name=name, pins=args, parameters=kwargs)
        self.library.append(subckt)
        self._scope.append(subckt)
    elif decl == '.ENDS':
        self._process_constraints()
        self._scope.pop()
    elif decl == '.PARAM':
        assert len(args) == 0, f"unsupported arguments {args}, probably missing default values"
        self._scope[-1].parameters.update({
            k.upper(): str(v).upper() for k, v in kwargs.items()
        })
    elif decl == '.MODEL':
        assert len(args) == 2, args
        name, base = args[0], args[1]
        assert self.library.find(name) is None, f"User is attempting to redeclare {name}"
        assert self.library.find(base) is not None, f"Base model {base} not found for model {name}"
        with set_context(self.library):
            self.library.append(Model(name=name, base=base, parameters=kwargs))