def instrument(self): # Use impl so that it throws as mandatory key we later rely on try: instrument = self._get_val_impl(["instrument", "name"], dict_to_parse=self._input) except KeyError: raise KeyError("instrument.name is missing") return SANSInstrument(instrument)