# Path: webtools/utils/imp.py
# def load_class(path):
#     """
#     Load class from path.
#     """
# 
#     mod_name, klass_name = None, None
# 
#     try:
#         mod_name, klass_name = path.rsplit('.', 1)
#         mod = import_module(mod_name)
#     except AttributeError as e:
#         raise RuntimeError("Error importing {0}: '{1}'".format(mod_name, e))
# 
#     try:
#         klass = getattr(mod, klass_name)
#     except AttributeError:
#         raise RuntimeError('Module "{0}" does not define a "{1}" class'.format(mod_name, klass_name))
# 
#     return klass


import sys
import argparse
import traceback
import importlib
import inspect
import logging
import logging.handlers
import os
from webtools.utils.imp import load_class
        self.root_logger.addHandler(self.console)

    def _adjunst_logging_level(self, options):
        # Set up logging to a file
        if options.log_file:
            file_handler = logging.FileHandler(
                filename=options.log_file,
            )
            formatter = logging.Formatter(self.LOG_FILE_MESSAGE_FORMAT)
            file_handler.setFormatter(formatter)
            self.root_logger.addHandler(file_handler)

        console_level = {
            0: logging.WARNING,
            1: logging.INFO,
            2: logging.DEBUG,
        }.get(options.verbose_level, logging.DEBUG)
        self.console.setLevel(console_level)

    def _load_settings(self, settings_path):
        """
        Load a main tornado application.
        """
        if settings_path is None:
            if "WEBTOOLS_SETTINGS" not in os.environ:
                return None

            settings_path = os.environ["WEBTOOLS_SETTINGS"]

        try:

# Path: webtools/utils/imp.py
# def load_class(path):
#     """
#     Load class from path.
#     """
# 
#     mod_name, klass_name = None, None
# 
#     try:
#         mod_name, klass_name = path.rsplit('.', 1)
#         mod = import_module(mod_name)
#     except AttributeError as e:
#         raise RuntimeError("Error importing {0}: '{1}'".format(mod_name, e))
# 
#     try:
#         klass = getattr(mod, klass_name)
#     except AttributeError:
#         raise RuntimeError('Module "{0}" does not define a "{1}" class'.format(mod_name, klass_name))
# 
#     return klass


# Path: webtools/management/base.py
import sys
import argparse
import traceback
import importlib
import inspect
import logging
import logging.handlers
import os
from webtools.utils.imp import load_class

        self.root_logger.addHandler(self.console)

    def _adjunst_logging_level(self, options):
        # Set up logging to a file
        if options.log_file:
            file_handler = logging.FileHandler(
                filename=options.log_file,
            )
            formatter = logging.Formatter(self.LOG_FILE_MESSAGE_FORMAT)
            file_handler.setFormatter(formatter)
            self.root_logger.addHandler(file_handler)

        console_level = {
            0: logging.WARNING,
            1: logging.INFO,
            2: logging.DEBUG,
        }.get(options.verbose_level, logging.DEBUG)
        self.console.setLevel(console_level)

    def _load_settings(self, settings_path):
        """
        Load a main tornado application.
        """
        if settings_path is None:
            if "WEBTOOLS_SETTINGS" not in os.environ:
                return None

            settings_path = os.environ["WEBTOOLS_SETTINGS"]

        try:

            settings_cls = load_class(settings_path)