def ancestry(path):
 out = []
 last_path = None
 while path:
  path = os.path.dirname(path)
  if (path == last_path):
   break
  last_path = path
  if path:
   out.insert(0, path)
 return out

def ancestry ( path ) : out = [ ] last_path = None while path : path = os . path . dirname ( path ) if ( path == last_path ) : break last_path = path if path : out . insert ( 0 , path ) return out
return a list consisting of paths parent directory .