code: def _signal_handler(self, signum, frame):
          
          if self._options.config:
              with open(self._options.config, "w") as cfg:
                  yaml.dump(self._home_assistant_config(), cfg)
                  print(
                      "Dumped home assistant configuration at",
                      self._options.config)
          self._connection.close()
          sys.exit(0)
docs: Method called when handling signals