def load_class(dotted_path):
  """Loads and returns a class definition provided a dotted path
  specification the last part of the dotted path is the class name
  and there is at least one module name preceding the class name.

  Notes:
  You will need to ensure that the module you are trying to load
  exists in the Python path.

  Examples:
  - module.name.ClassName    # Provided module.name is in the Python path.
  - module.ClassName         # Provided module is in the Python path.

  What won't work:
  - ClassName
  - modle.name.ClassName     # Typo in module name.
  - module.name.ClasNam      # Typo in classname.
  """
  dotted_path_split = dotted_path.split('.')
  if len(dotted_path_split) > 1:
    klass_name = dotted_path_split[-1]
    module_name = '.'.join(dotted_path_split[:-1])

    module = load_module(module_name)
    if has_attribute(module, klass_name):
      klass = getattr(module, klass_name)
      return klass
      # Finally create and return an instance of the class
      #return klass(*args, **kwargs)
    else:
      raise AttributeError('Module %s does not have class attribute %s' % (
      module_name, klass_name))
  else:
    raise ValueError(
      dotted_path % 'Dotted module path %s must contain a module name and a classname')
dataset/ETHPy150Open austinwagner/sublime-sourcepawn/watchdog/utils/__init__.py/load_class/swapped operands of `%`