def import_class(class_path):
splitted = class_path.split('<STR_LIT:.>')<EOL>mod_path = '<STR_LIT:.>'.join(splitted[:-<NUM_LIT:1>])<EOL>class_name = splitted[-<NUM_LIT:1>]<EOL>class_mod = __import__(mod_path, {}, {}, [class_name])<EOL>try:<EOL><INDENT>cls = getattr(class_mod, class_name)<EOL><DEDENT>except AttributeError:<EOL><INDENT>raise ImportError("<STR_LIT>" % class_path)<EOL><DEDENT>return cls<EOL>
Returns class from the given path.

For example, in order to get class located at
``mynodes.MyNode``:

    try:
        hgrepo = import_class('mynodes.MyNode')
    except ImportError:
        # hadle error