import importlib


def _str_to_class(module_name, class_name):
    """
    Return a class instance from a string reference
    """
    class_instance = None
    try:
        module_instance = importlib.import_module(module_name)
        try:
            class_instance = getattr(module_instance, class_name)
        except AttributeError:
            pass
    except ImportError:
        pass
    return class_instance