def __import__(name, globals=None, locals=None, fromlist=None):
 try:
  return sys.modules[name]
 except KeyError:
  pass
 module_name = name.split('.')[(-1)]
 module_path = os.path.join(EXAMPLE_DIR, *name.split('.')[:(-1)])
 (fp, pathname, description) = imp.find_module(module_name, [module_path])
 try:
  return imp.load_module(module_name, fp, pathname, description)
 finally:
  if fp:
   fp.close()

def __import__ ( name , globals = None , locals = None , fromlist = None ) : try : return sys . modules [ name ] except KeyError : pass module_name = name . split ( '.' ) [ ( - 1 ) ] module_path = os . path . join ( EXAMPLE_DIR , * name . split ( '.' ) [ : ( - 1 ) ] ) ( fp , pathname , description ) = imp . find_module ( module_name , [ module_path ] ) try : return imp . load_module ( module_name , fp , pathname , description ) finally : if fp : fp . close ( )
an alternative to the import function so that we can import modules defined as strings .