def split_all_category_roots(cat):
    """Takes category like `foo/bar/baz` and returns its roots
    ex: ['foo/bar/baz', 'foo/bar', 'foo']
    """
    if cat and '/' in cat:
        cats = [cat]
        is_root = False
        raw = cat
        while not is_root:
            item = [part for part in raw.rpartition('/') if part]
            raw = item[0]
            cats.append(raw)
            if len(item) == 1:
                is_root = True
        return cats
    else:
        return [cat]