function createContext( out, ostream, sandbox ) {
	var context;
	var keys;
	var i;

	// Create the REPL context...
	if ( sandbox ) {
		// Create a sandboxed context:
		context = vm.createContext();

		// Assign globals from the current global context to the sandboxed context (note: shallow copy!)...
		keys = objectKeys( GLOBALS );
		for ( i = 0; i < keys.length; i++ ) {
			setReadOnly( context, keys[ i ], GLOBALS[ keys[ i ] ] );
		}
		// Create a circular reference as in Node.js:
		setReadOnly( context, 'global', context );

		// Create a new `console` interface:
		setReadOnly( context, 'console', new Console( ostream ) );

		// Create a new `module` object:
		setReadOnly( context, 'module', new Module( '<repl>' ) );

		// Create a new `require` function:
		setReadOnly( context, 'require', createRequire( context.module ) );
	} else {
		context = getGlobal(); // current global variable

		// Create a new `module` object:
		setConfigurableReadOnly( context, 'module', new Module( '<repl>' ) );

		// Create a new `require` function:
		setConfigurableReadOnly( context, 'require', createRequire( context.module ) );
	}
	context.module.paths = resolveLookupPaths( '<repl>', module, true ) || [];

	out.push( 'global', context.global );
	out.push( 'require', context.require );

	return context;
}
Creates a REPL evaluation context.

@private
@param {Array} out - strided output array for storing variables added to the evaluation context
@param {Stream} ostream - output stream
@param {boolean} sandbox - boolean indicating whether the evaluation context should be "sandboxed"
@returns {Object} context