def METHOD_NAME(grr_api=None,
                         client_ids=None,
                         hostnames=None,
                         checkin_duration_threshold=3600):
  """Get client urns for end-to-end tests.
  Args:
    grr_api: GRR API object.
    client_ids: list of client id strings.
    hostnames: list of hostnames to search for.
    checkin_duration_threshold: clients that haven't checked in for this long
      will be excluded. Value is specified in seconds. Default is 1 hour.
  Returns:
    client_id_set: list of api_client.Client objects corresponding to every
                   client found.
  """
  if client_ids:
    client_ids = set(client_ids)
  else:
    client_ids = set()
  clients = []
  if hostnames:
    hostnames = set(hostnames)
    logging.info("Searching for clients corresponding to %d hostnames: %s.",
                 len(hostnames), ",".join(hostnames))
    for hostname in hostnames:
      clients_for_host = list(grr_api.SearchClients(query="host:" + hostname))
      clients.extend(clients_for_host)
  for client_id in client_ids:
    client_obj = grr_api.Client(client_id).Get()
    clients.append(client_obj)
  results = []
  for client_obj in clients:
    time_since_last_seen = time.time() - client_obj.data.last_seen_at * 1e-6
    if time_since_last_seen <= checkin_duration_threshold:
      results.append(client_obj)
  logging.info("Filtered out %d inactive clients.", len(clients) - len(results))
  return results