def _tokenize_path(path):
    """
    Helper function that removes trailing slash
    and split the path into bits.

    e.g.: "/api/foo/" -> ["", "api", "foo"]
    """
    return path.rstrip("/").split("/")