code: def check_exists(filename, oappend=False):
      
      if op.exists(filename):
          if oappend:
              return oappend
          logging.error("`{0}` found, overwrite (Y/N)?".format(filename))
          overwrite = (raw_input() == 'Y')
      else:
          overwrite = True
  
      return overwrite
docs: Avoid overwriting some files accidentally.