code: def register_scenario(self, scenario_name, handler):
          
  
          if scenario_name in self._known_scenarios:
              raise ArgumentError("Attempted to add the same scenario name twice", scenario_name=scenario_name,
                                  previous_handler=self._known_scenarios[scenario_name])
  
          self._known_scenarios[scenario_name] = handler
docs: Register a scenario handler for this object.
  
          Scenario handlers are callable functions with no positional arguments
          that can be called by name with the load_scenario function and should
          prepare the emulated object into a known state.  The purpose of a
          scenario is to make it easy to get a device into a specific state for
          testing purposes that may otherwise be difficult or time consuming to
          prepare on the physical, non-emulated device.
  
          Args:
              scenario_name (str): The name of this scenario that can be passed to
                  load_scenario later in order to invoke the scenario.
              handler (callable): A callable function that takes no positional
                  arguments and can prepare this object into the given scenario
                  state.  It may take required or optional keyword arguments that
                  may be passed to `load_scenario` if needed.