def create_environment(task: int,
                       training: bool = True,
                       stop_after_seeing_new_results: bool = False) -> NQEnv:
  """Creates an NQEnvironment.

  Args:
    task:  Used to set the random seed of the environment.  In SeedRL context,
      it makes sense to pass in the task number of the actor (hence the argument
      name), but really, this is just a random seed.
    training:  Whether this environment should serve training or development
      episodes.
    stop_after_seeing_new_results:  If False, [stop] means that you return the
      latest results (corresponding to your last query).  If True, [stop] means
      that you disregard the latest results and return the pen-ultimate results.

  Returns:
    An NQEnv instance.
  """
  logging.info('Creating environment: nq')
  env = NQEnv(
      training=training,
      nq_server=server.get_nq_server(),
      stop_after_seeing_new_results=stop_after_seeing_new_results)
  env.seed(task)
  return env
Creates an NQEnvironment.

  Args:
    task:  Used to set the random seed of the environment.  In SeedRL context,
      it makes sense to pass in the task number of the actor (hence the argument
      name), but really, this is just a random seed.
    training:  Whether this environment should serve training or development
      episodes.
    stop_after_seeing_new_results:  If False, [stop] means that you return the
      latest results (corresponding to your last query).  If True, [stop] means
      that you disregard the latest results and return the pen-ultimate results.

  Returns:
    An NQEnv instance.
  
language/search_agents/muzero/env.py