code: def autodiscover_media_extensions():
      
      import copy
      from django.conf import settings
      from django.utils.module_loading import module_has_submodule
  
      for app in settings.INSTALLED_APPS:
          mod = import_module(app)
          try:
              import_module('%s.media_extension' % app)
          except:
              if module_has_submodule(mod, 'media_extension'):
                  raise
docs: Auto-discover INSTALLED_APPS media_extensions.py modules and fail silently when
      not present. This forces an import on them to register any media extension bits
      they may want.
  
      Rip of django.contrib.admin.autodiscover()