def levelize_path(path):
 parts = tuple(filter(None, path.split('/')))
 return [('/' + '/'.join(parts[:n])) for n in range(len(parts), 0, (-1))]

def levelize_path ( path ) : parts = tuple ( filter ( None , path . split ( '/' ) ) ) return [ ( '/' + '/' . join ( parts [ : n ] ) ) for n in range ( len ( parts ) , 0 , ( - 1 ) ) ]
splits given path to list of paths removing latest level in each step .