code: def load_widget(path):
      
      i = path.rfind('.')
      module, attr = path[:i], path[i + 1:]
      try:
          mod = import_module(module)
      except (ImportError, ValueError) as e:
          error_message = 'Error importing widget for BleachField %s: "%s"'
          raise ImproperlyConfigured(error_message % (path, e))
  
      try:
          cls = getattr(mod, attr)
      except AttributeError:
          raise ImproperlyConfigured(
              'Module "%s" does not define a "%s" widget' % (module, attr)
          )
  
      return cls
docs: Load custom widget for the form field