def _find_installed_apps_entry(module_label):
 modules = module_label.split('.')
 combinations = ['.'.join(modules[:(- count)]) for count in range(1, len(modules))]
 for app_name in combinations:
  entry = _get_installed_apps_entry(app_name)
  if entry:
   return (entry, app_name)
 raise AppNotFoundError(("Couldn't find an app to import %s from" % module_label))

def _find_installed_apps_entry ( module_label ) : modules = module_label . split ( '.' ) combinations = [ '.' . join ( modules [ : ( - count ) ] ) for count in range ( 1 , len ( modules ) ) ] for app_name in combinations : entry = _get_installed_apps_entry ( app_name ) if entry : return ( entry , app_name ) raise AppNotFoundError ( ( "Couldn't find an app to import %s from" % module_label ) )
given a module label .