def service_get(env, jones):
    if not jones.exists():
        return redirect(url_for('index'))

    children = jones.get_child_envs(Env.Root)
    is_leaf = lambda child: len(child) and not any(
        c.find(child + '/') >= 0 for c in children)

    try:
        version, config = jones.get_config_by_env(env)
    except NoNodeException:
        return redirect(url_for('services', service=jones.service))

    childs = imap(dict, izip(
        izip(repeat('env'), imap(Env, children)),
        izip(repeat('is_leaf'), imap(is_leaf, children))))

    vals = {
        "env": env,
        "version": version,
        "children": list(childs),
        "config": config,
        "view": jones.get_view_by_env(env),
        "service": jones.service,
        "associations": jones.get_associations(env)
    }
    if request_wants('application/json'):
        return jsonify(vals)
    else:
        return render_template('service.j2', **vals)