code: def autodiscover():
      
      global LOADING_SOCKETIO
      if LOADING_SOCKETIO:
          return
      LOADING_SOCKETIO = True
  
      import imp
      from django.conf import settings
  
      for app in settings.INSTALLED_APPS:
  
          try:
              app_path = import_module(app).__path__
          except AttributeError:
              continue
  
          try:
              imp.find_module('sockets', app_path)
          except ImportError:
              continue
  
          import_module("%s.sockets" % app)
  
      LOADING_SOCKETIO = False
docs: Auto-discover INSTALLED_APPS sockets.py modules and fail silently when
      not present. NOTE: socketio_autodiscover was inspired/copied from
      django.contrib.admin autodiscover