def get_breadcrumbs(path, base='', topname='.', subarchivepath=None):
    """Generate (label, subpath, sep, is_last) tuples.
    """
    base = base.rstrip('/') + '/'
    subpathfull = path.strip('/')
    if subarchivepath is None:
        archivepath = None
    elif subarchivepath == '':
        archivepath = subpathfull
    else:
        archivepath = subpathfull[0:-(len(subarchivepath) + 1)]
    if subpathfull:
        yield topname, base, '/', False
        subpaths = []
        parts = subpathfull.split('/')
        parts_len = len(parts)
        for idx, part in enumerate(parts):
            subpaths.append(part)
            subpath = '/'.join(subpaths)
            if subpath == archivepath:
                yield part[:-1
                    ], base + subpath + '/', '!/', idx == parts_len - 1
            else:
                yield part, base + subpath + '/', '/', idx == parts_len - 1
    else:
        yield topname, base, '/', True
