'Execute code within a restricted environment.
The code parameter must either be a string containing one or more
lines of Python code, or a compiled code object, which will be
executed in the restricted environment\'s __main__ module.'

def r_exec(self, code):

    m = self.add_module('__main__')
    exec code in m.__dict__
