def locate_app(app_id):
 __traceback_hide__ = True
 if (':' in app_id):
  (module, app_obj) = app_id.split(':', 1)
 else:
  module = app_id
  app_obj = None
 try:
  __import__(module)
 except ImportError:
  if sys.exc_info()[(-1)].tb_next:
   raise
  else:
   raise NoAppException(('The file/path provided (%s) does not appear to exist.  Please verify the path is correct.  If app is not on PYTHONPATH, ensure the extension is .py' % module))
 mod = sys.modules[module]
 if (app_obj is None):
  app = find_best_app(mod)
 else:
  app = getattr(mod, app_obj, None)
  if (app is None):
   raise RuntimeError(('Failed to find application in module "%s"' % module))
 return app

def locate_app ( app_id ) : __traceback_hide__ = True if ( ':' in app_id ) : ( module , app_obj ) = app_id . split ( ':' , 1 ) else : module = app_id app_obj = None try : __import__ ( module ) except ImportError : if sys . exc_info ( ) [ ( - 1 ) ] . tb_next : raise else : raise NoAppException ( ( 'The file/path provided (%s) does not appear to exist.  Please verify the path is correct.  If app is not on PYTHONPATH, ensure the extension is .py' % module ) ) mod = sys . modules [ module ] if ( app_obj is None ) : app = find_best_app ( mod ) else : app = getattr ( mod , app_obj , None ) if ( app is None ) : raise RuntimeError ( ( 'Failed to find application in module "%s"' % module ) ) return app
attempts to locate the application .