def get_agent_by_host(session, agent_host):
 with session.begin(subtransactions=True):
  query = session.query(agent_model.Agent)
  query = query.filter((agent_model.Agent.host == agent_host))
 for agent in query:
  if get_agent_ip(agent):
   return agent

def get_agent_by_host ( session , agent_host ) : with session . begin ( subtransactions = True ) : query = session . query ( agent_model . Agent ) query = query . filter ( ( agent_model . Agent . host == agent_host ) ) for agent in query : if get_agent_ip ( agent ) : return agent
return a l2 agent on the host .