def find_related_module(app, related_name):
 try:
  app_path = importlib.import_module(app).__path__
 except ImportError as exc:
  warn(('Autodiscover: Error importing %s.%s: %r' % (app, related_name, exc)))
  return
 except AttributeError:
  return
 try:
  (f, _, _) = imp.find_module(related_name, app_path)
  (f and f.close())
 except ImportError:
  return
 return importlib.import_module('{0}.{1}'.format(app, related_name))

def find_related_module ( app , related_name ) : try : app_path = importlib . import_module ( app ) . __path__ except ImportError as exc : warn ( ( 'Autodiscover: Error importing %s.%s: %r' % ( app , related_name , exc ) ) ) return except AttributeError : return try : ( f , _ , _ ) = imp . find_module ( related_name , app_path ) ( f and f . close ( ) ) except ImportError : return return importlib . import_module ( '{0}.{1}' . format ( app , related_name ) )
given an application name and a module name .