def rpairs(path):
    """Yield tuples with path split at '/', starting with the full path.
    No leading, trailing or double '/', please.
    >>> for x in rpairs(b'foo/bar/baz'): print(x)
    ('foo/bar/baz', '')
    ('foo/bar', 'baz')
    ('foo', 'bar/baz')
    ('.', 'foo/bar/baz')
    """
    i = len(path)
    while i != -1:
        yield path[:i], path[i + 1:]
        i = path.rfind(b'/', 0, i)
    yield b'.', path
