def _import_module_or_none(module):
 try:
  __import__(module)
  return sys.modules[module]
 except ImportError as ie:
  tb = sys.exc_info()[2]
  top_frame = traceback.extract_tb(tb)[(-1)]
  err_file = re.sub('\\.pyc', '.py', top_frame[0])
  my_file = re.sub('\\.pyc', '.py', __file__)
  if (err_file == my_file):
   return None
  else:
   LOG.error(("Failed to import '%s'" % (module,)))
   raise

def _import_module_or_none ( module ) : try : __import__ ( module ) return sys . modules [ module ] except ImportError as ie : tb = sys . exc_info ( ) [ 2 ] top_frame = traceback . extract_tb ( tb ) [ ( - 1 ) ] err_file = re . sub ( '\\.pyc' , '.py' , top_frame [ 0 ] ) my_file = re . sub ( '\\.pyc' , '.py' , __file__ ) if ( err_file == my_file ) : return None else : LOG . error ( ( "Failed to import '%s'" % ( module , ) ) ) raise
like import_module .