'Return agent of agent_type for the specified host.'

@db_api.retry_if_session_inactive()
def get_enabled_agent_on_host(self, context, agent_type, host):

    query = context.session.query(agent_model.Agent)
    query = query.filter((agent_model.Agent.agent_type == agent_type), (agent_model.Agent.host == host), (agent_model.Agent.admin_state_up == sql.true()))
    try:
        agent = query.one()
    except exc.NoResultFound:
        LOG.debug('No    enabled    %(agent_type)s    agent    on    host    %(host)s', {'agent_type': agent_type, 'host': host})
        return
    if utils.is_agent_down(agent.heartbeat_timestamp):
        LOG.warning(_LW('%(agent_type)s    agent    %(agent_id)s    is    not    active'), {'agent_type': agent_type, 'agent_id': agent.id})
    return agent
