def _canonical_hsdir(hsdir):
    """
    Internal helper.

    :return: the absolute path for 'hsdir' (and issue a warning)
        issuing a warning) if it was relative. Otherwise, returns the path
        unmodified.
    """
    if not isabs(hsdir):
        abs_hsdir = abspath(hsdir)
        warnings.warn(
            "Onions service directory ({}) is relative and has"
            " been resolved to '{}'".format(hsdir, abs_hsdir)
        )
        hsdir = abs_hsdir
    return hsdir
Internal helper.

    :return: the absolute path for 'hsdir' (and issue a warning)
        issuing a warning) if it was relative. Otherwise, returns the path
        unmodified.