docs: def _start_host_agent(self):
          '''
          This method starts saves the host agent descriptor and runs it.
          To make this happen following conditions needs to be fulfilled:
           - it is a master agency,
           - we are not starting a host agent already,
           - we are not terminating,
           - and last but not least, we dont have a host agent running.
          '''
  
          def set_flag(value):
              self._starting_host = value
  
          if not self._can_start_host_agent():
              return
  
          def handle_error_on_get(fail, connection, doc_id):
              fail.trap(NotFoundError)
              factory = serialization.lookup('host_agent')
              desc = factory(shard=u'lobby', doc_id=doc_id,
                             agency_id=self.agency_id)
              self.info("Host Agent descriptor not found in database, "
                        "creating a brand new instance.")
              return connection.save_document(desc)
  
          def handle_success_on_get(desc):
              msg = ("Descriptor of host agent has been found in "
                     "database (hostname: %s). I will wait patiently "
                     "until in disappears. It should happened any minute now "
                     "providing there is still a monitor agent in the "
                     "cluster who will take care of it. In other case "
                     "you would have to cleanup the database. In development "
                     "the --force-host-restart feat script option is your "
                     "only friend. " % desc.doc_id)
              raise error.FeatError(msg)
  
          set_flag(True)
          self.info('Starting host agent.')
          conn = self._database.get_connection()
  
          doc_id = self._get_host_agent_id()
          d = defer.Deferred()
          d.addCallback(defer.drop_param, self._database.wait_connected)
          d.addCallback(defer.drop_param, conn.get_document, doc_id)
          d.addCallbacks(handle_success_on_get, handle_error_on_get,
                         errbackArgs=(conn, doc_id, ))
          d.addCallback(self.start_agent, hostdef=self._hostdef)
          d.addBoth(defer.bridge_param, set_flag, False)
          d.addErrback(self._host_restart_failed)
          time.callLater(0, d.callback, None)