code: def find_project_file(start_dir, basename):
      '''Walk up the directory tree until we find a file of the given name.'''
      prefix = os.path.abspath(start_dir)
      while True:
          candidate = os.path.join(prefix, basename)
          if os.path.isfile(candidate):
              return candidate
          if os.path.exists(candidate):
              raise PrintableError(
                  "Found {}, but it's not a file.".format(candidate))
          if os.path.dirname(prefix) == prefix:
              # We've walked all the way to the top. Bail.
              raise PrintableError("Can't find " + basename)
          # Not found at this level. We must go...shallower.
          prefix = os.path.dirname(prefixf find_project_file(start_dir, basename):
      '''Walk up the directory tree until we find a file of the given name.'''
      prefix = os.path.abspath(start_dir)
      while True:
          candidate = os.path.join(prefix, basename)
          if os.path.isfile(candidate):
              return candidate
          if os.path.exists(candidate):
              raise PrintableError(
                  "Found {}, but it's not a file.".format(candidate))
          if os.path.dirname(prefix) == prefix:
              # We've walked all the way to the top. Bail.
              raise PrintableError("Can't find " + basename)
          # Not found at this level. We must go...shallower.
          prefix = os.path.dirname(prefix)
docs: Walk up the directory tree until we find a file of the given name.