def check_environment(env, *, return_n_agents=False):
    """Check environment.

    :param UnityEnvironment env: unity environment.
    :param bool return_n_agents: True for returning also the number of agents.
        For backward compatibility.
    """
    # get the default brain
    brain_name = env.brain_names[0]
    brain = env.brains[brain_name]

    print("Brain name: ", brain_name)
    print("Brain: ", brain)

    # reset the environment
    env_info = env.reset(train_mode=False)[brain_name]

    # number of agents in the environment
    n_agents = len(env_info.agents)
    print('Number of agents:', n_agents)

    # examine the state space
    state = env_info.vector_observations[0]
    print('States look like:', state)
    state_size = len(state)
    print('States have length:', state_size)

    # number of actions
    action_size = brain.vector_action_space_size
    print('Number of actions:', action_size)

    if return_n_agents:
        return brain_name, state_size, action_size, n_agents
    return brain_name, state_size, action_size