def load_tag_library(libname):
 if (django.VERSION < (1, 9)):
  from django.template.base import get_library, InvalidTemplateLibrary
  try:
   lib = get_library(libname)
   return lib
  except InvalidTemplateLibrary:
   return None
 else:
  from django.template.backends.django import get_installed_libraries
  from django.template.library import InvalidTemplateLibrary
  try:
   lib = get_installed_libraries()[libname]
   lib = importlib.import_module(lib).register
   return lib
  except (InvalidTemplateLibrary, KeyError):
   return None

def load_tag_library ( libname ) : if ( django . VERSION < ( 1 , 9 ) ) : from django . template . base import get_library , InvalidTemplateLibrary try : lib = get_library ( libname ) return lib except InvalidTemplateLibrary : return None else : from django . template . backends . django import get_installed_libraries from django . template . library import InvalidTemplateLibrary try : lib = get_installed_libraries ( ) [ libname ] lib = importlib . import_module ( lib ) . register return lib except ( InvalidTemplateLibrary , KeyError ) : return None
load a templatetag library on multiple django versions .