def preparse(output_format):
    """ Do any special processing of a template, and return the result.
    """
    try:
        return templating.preparse(output_format, lambda path: os.path.join(config.config_dir, "templates", path))
    except ImportError as exc:
        if "tempita" in str(exc):
            raise error.UserError("To be able to use Tempita templates, install the 'tempita' package (%s)\n"
                "    Possibly USING THE FOLLOWING COMMAND:\n"
                "        %s/easy_install tempita" % (exc, os.path.dirname(sys.executable)))
        raise
    except IOError as exc:
        raise error.LoggableError("Cannot read template: {}".format(exc))
Do any special processing of a template, and return the result.