code: def recursive_dirname(f):
    
    prev = None
    while f != prev:
      yield f
      prev = f
      f = os.path.dirname(f)
    yield ''
docs: Given a relative path like 'a/b/c/d', yield all ascending path components like:
  
          'a/b/c/d'
          'a/b/c'
          'a/b'
          'a'
          ''