def strip_trailing_slash(text) -> str:
    """
    Strip trailing slash if any.

    :param text: Path string
    :return: Path string without trailing slash.
    """
    if text is None:
        return ""

    l = len(text)

    if not l:
        return ""

    end = l-1 if text[l-1] == "/" else l
    return text[:end]