<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def load_config(f, spec):
 """Return the ConfigObj for the specified file :param f: the config file path :type f: str :param spec: the path to the configspec :type spec: str :returns: the loaded ConfigObj :rtype: ConfigObj :raises: ConfigError """

    dirname = os.path.dirname(f)
    if not os.path.exists(dirname):
        os.makedirs(dirname)
    c = ConfigObj(infile=f, configspec=spec,
                  interpolation=False, create_empty=True)
    try:
        clean_config(c)
    except ConfigError, e:
        msg = "Config %s could not be loaded. Reason: %s" % (c.filename, e)
        log.debug(msg)
        raise ConfigError(msg)
    return c