code: def register_hooks(self, on_terminate=None, on_reload=None,
                         on_new_worker=None, on_dead_worker=None):
          
  
          if on_terminate is not None:
              _utils.check_callable(on_terminate, 'on_terminate')
              self._hooks['terminate'].append(on_terminate)
          if on_reload is not None:
              _utils.check_callable(on_reload, 'on_reload')
              self._hooks['reload'].append(on_reload)
          if on_new_worker is not None:
              _utils.check_callable(on_new_worker, 'on_new_worker')
              self._hooks['new_worker'].append(on_new_worker)
          if on_dead_worker is not None:
              _utils.check_callable(on_dead_worker, 'on_dead_worker')
              self._hooks['dead_worker'].append(on_dead_worker)
docs: Register hook methods
  
          This can be callable multiple times to add more hooks, hooks are
          executed in added order. If a hook raised an exception, next hooks
          will be not executed.
  
          :param on_terminate: method called on SIGTERM
          :type on_terminate: callable()
          :param on_reload: method called on SIGHUP
          :type on_reload: callable()
          :param on_new_worker: method called in the child process when this one
                                is ready
          :type on_new_worker: callable(service_id, worker_id, service_obj)
          :param on_new_worker: method called when a child died
          :type on_new_worker: callable(service_id, worker_id, exit_code)
  
          If window support is planned, hooks callable must support
          to be pickle.pickle(). See CPython multiprocessing module documentation
          for more detail.