def get_environment(envs, env_id):
    """Gets environment with id exists in environments list."""
    if not envs or not isinstance(envs, list):
        return False

    matching_envs = [env for env in envs if env["id"] == env_id]
    return matching_envs[0] if len(matching_envs) > 0 else None