<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def module_cache_get(cache, module):
 """ Import a module with an optional yaml config file, but only if we haven't imported it already. :param cache: object which holds information on which modules and config files have been loaded and whether config files should be loaded. :param module: the path of the module to load. :returns: the loaded module. """

    if getattr(cache, "config", False):
        config_file = module[:-2] + "yaml"
        if config_file not in cache.config_files and os.path.exists(config_file):
            try:
                config = yaml_safe_load(config_file, type=dict)
            except TypeError as e:
                tangelo.log_warning("TANGELO", "Bad configuration in file %s: %s" % (config_file, e))
                raise
            except IOError:
                tangelo.log_warning("TANGELO", "Could not open config file %s" % (config_file))
                raise
            except ValueError as e:
                tangelo.log_warning("TANGELO", "Error reading config file %s: %s" % (config_file, e))
                raise
            cache.config_files[config_file] = True
        else:
            config = {}
        cherrypy.config["module-config"][module] = config
        cherrypy.config["module-store"].setdefault(module, {})
    # If two threads are importing the same module nearly concurrently, we
    # could load it twice unless we use the import lock.
    imp.acquire_lock()
    try:
        if module not in cache.modules:
            name = module[:-3]

            # load the module.
            service = imp.load_source(name, module)
            cache.modules[module] = service
        else:
            service = cache.modules[module]
    finally:
        imp.release_lock()
    return service