def _class_instance_from_name(class_name, *arg, **kwarg):
    """
    class_name is of the form modA.modB.modC.class module_path splits on "."
    and the import_path is then ['modA','modB','modC'] the __import__ call is
    really annoying but essentially it reads like:

    import class from modA.modB.modC

    - Then the module variable points to modC
    - Then you get the class from the module.

    """
    module_path = class_name.split('.')
    import_path = module_path[0:-1]
    module = __import__('.'.join(import_path), fromlist=[module_path[-1]])
    class_ = getattr(module, module_path[-1])
    instance = class_(*arg, **kwarg)
    return instance
