#NEWLINE# def load_tag_library( libname ) : #NEWLINE# #INDENT# "Load a templatetag library on multiple Django versions.\n\n    Returns None if the library isn't loaded.\n    " #NEWLINE# if ( django . VERSION < ( 1 , 9 ) ) : #NEWLINE# #INDENT# from django.template.base import get_library , InvalidTemplateLibrary #NEWLINE# try : #NEWLINE# #INDENT# lib = get_library ( lib ) #NEWLINE# return lib #NEWLINE# #UNINDENT# except InvalidTemplateLibrary : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# from django.template.backends.django import get_installed_libraries #NEWLINE# from django.template.library import InvalidTemplateLibrary #NEWLINE# try : #NEWLINE# #INDENT# lib = get_installed_libraries ( ) [ libname ] #NEWLINE# lib = importlib . import_module ( lib ) . register #NEWLINE# return lib #NEWLINE# #UNINDENT# except ( InvalidTemplateLibrary , KeyError ) : #NEWLINE# #INDENT# return None