def import_class(class_path):
try:<EOL><INDENT>from django.utils.importlib import import_module<EOL>module_name = '<STR_LIT:.>'.join(class_path.split("<STR_LIT:.>")[:-<NUM_LIT:1>])<EOL>mod = import_module(module_name)<EOL>return getattr(mod, class_path.split("<STR_LIT:.>")[-<NUM_LIT:1>])<EOL><DEDENT>except Exception as detail:<EOL><INDENT>raise ImportError(detail)<EOL><DEDENT>
imports and returns given class string.

    :param class_path: Class path as string
    :type class_path: str

    :returns: Class that has given path
    :rtype: class

    :Example:

    >>> import_class('collections.OrderedDict').__name__
    'OrderedDict'