<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list_nodes():
 """ Return a list of all nodes """

    token = session.get('token')
    node = nago.core.get_node(token)
    if not node.get('access') == 'master':
        return jsonify(status='error', error="You need master access to view this page")

    nodes = nago.core.get_nodes().values()
    return render_template('nodes.html', **locals())