def walk_up_dirs(path):
prev_path = None<EOL>current_path = os.path.abspath(path)<EOL>while current_path != prev_path:<EOL><INDENT>yield current_path<EOL>prev_path = current_path<EOL>current_path = os.path.dirname(prev_path)<EOL><DEDENT>
Yields absolute directories starting with the given path, and iterating
    up through all it's parents, until it reaches a root directory