code: def auto_schedule_hosting_devices(self, plugin, context, agent_host):
          
          query = context.session.query(bc.Agent)
          query = query.filter_by(agent_type=c_constants.AGENT_TYPE_CFG,
                                  host=agent_host, admin_state_up=True)
          try:
              cfg_agent_db = query.one()
          except (exc.MultipleResultsFound, exc.NoResultFound):
              LOG.debug('No enabled Cisco cfg agent on host %s', agent_host)
              return
          if cfg_agentschedulers_db.CfgAgentSchedulerDbMixin.is_agent_down(
                  cfg_agent_db.heartbeat_timestamp):
              LOG.warning('Cisco cfg agent %s is not alive',
                          cfg_agent_db.id)
          return cfg_agent_db
docs: Schedules unassociated hosting devices to Cisco cfg agent.
  
          Schedules hosting devices to agent running on <agent_host>.