def import_class(import_str):
    mod_str, _sep, class_str = import_str.rpartition('.')
    try:
        __import__(mod_str)
        return getattr(sys.modules[mod_str], class_str)
    except (ValueError, AttributeError):
        raise ImportError('Class %s cannot be found (%s)' %
                          (class_str,
                           traceback.format_exception(*sys.exc_info())))
Returns a class from a string including module and class.
dataset/ETHPy150Open openstack-dev/heat-cfnclient/heat_cfnclient/openstack/common/importutils.py/import_class