def restricted(ccode, environment=None, layer='Unknown'):
 if (environment is None):
  environment = {}
 environment['__file__'] = layer
 environment['__name__'] = '__restricted__'
 try:
  exec ccode in environment
 except HTTP:
  raise
 except RestrictedError:
  raise
 except Exception as error:
  (etype, evalue, tb) = sys.exc_info()
  if (__debug__ and ('WINGDB_ACTIVE' in os.environ)):
   sys.excepthook(etype, evalue, tb)
  del tb
  output = ('%s %s' % (etype, evalue))
  raise RestrictedError(layer, ccode, output, environment)

def restricted ( ccode , environment = None , layer = 'Unknown' ) : if ( environment is None ) : environment = { } environment [ '__file__' ] = layer environment [ '__name__' ] = '__restricted__' try : exec ccode in environment except HTTP : raise except RestrictedError : raise except Exception as error : ( etype , evalue , tb ) = sys . exc_info ( ) if ( __debug__ and ( 'WINGDB_ACTIVE' in os . environ ) ) : sys . excepthook ( etype , evalue , tb ) del tb output = ( '%s %s' % ( etype , evalue ) ) raise RestrictedError ( layer , ccode , output , environment )
runs code in environment and returns the output .