code: def _find_keep_files(root, keep):
      '''
      Compile a list of valid keep files (and directories).
      Used by _clean_dir()
      '''
      real_keep = set()
      real_keep.add(root)
      if isinstance(keep, list):
          for fn_ in keep:
              if not os.path.isabs(fn_):
                  continue
              fn_ = os.path.normcase(os.path.abspath(fn_))
              real_keep.add(fn_)
              while True:
                  fn_ = os.path.abspath(os.path.dirname(fn_))
                  real_keep.add(fn_)
                  drive, path = os.path.splitdrive(fn_)
                  if not path.lstrip(os.sep):
                      break
      return real_keef _find_keep_files(root, keep):
      '''
      Compile a list of valid keep files (and directories).
      Used by _clean_dir()
      '''
      real_keep = set()
      real_keep.add(root)
      if isinstance(keep, list):
          for fn_ in keep:
              if not os.path.isabs(fn_):
                  continue
              fn_ = os.path.normcase(os.path.abspath(fn_))
              real_keep.add(fn_)
              while True:
                  fn_ = os.path.abspath(os.path.dirname(fn_))
                  real_keep.add(fn_)
                  drive, path = os.path.splitdrive(fn_)
                  if not path.lstrip(os.sep):
                      break
      return real_keep
docs: Compile a list of valid keep files (and directories).
      Used by _clean_dir()