def get_library(library_name):
 lib = libraries.get(library_name, None)
 if (not lib):
  templatetags_modules = get_templatetags_modules()
  tried_modules = []
  for module in templatetags_modules:
   taglib_module = (u'%s.%s' % (module, library_name))
   tried_modules.append(taglib_module)
   lib = import_library(taglib_module)
   if lib:
    libraries[library_name] = lib
    break
  if (not lib):
   raise InvalidTemplateLibrary((u'Template library %s not found, tried %s' % (library_name, u','.join(tried_modules))))
 return lib

def get_library ( library_name ) : lib = libraries . get ( library_name , None ) if ( not lib ) : templatetags_modules = get_templatetags_modules ( ) tried_modules = [ ] for module in templatetags_modules : taglib_module = ( u'%s.%s' % ( module , library_name ) ) tried_modules . append ( taglib_module ) lib = import_library ( taglib_module ) if lib : libraries [ library_name ] = lib break if ( not lib ) : raise InvalidTemplateLibrary ( ( u'Template library %s not found, tried %s' % ( library_name , u',' . join ( tried_modules ) ) ) ) return lib
find a suitable lib .