def _check_fname(fname, overwrite=False, must_exist=False):
 if (not isinstance(fname, string_types)):
  raise TypeError('file name is not a string')
 if (must_exist and (not op.isfile(fname))):
  raise IOError(('File "%s" does not exist' % fname))
 if op.isfile(fname):
  if (not overwrite):
   raise IOError('Destination file exists. Please use option "overwrite=True" to force overwriting.')
  else:
   logger.info('Overwriting existing file.')

def _check_fname ( fname , overwrite = False , must_exist = False ) : if ( not isinstance ( fname , string_types ) ) : raise TypeError ( 'file name is not a string' ) if ( must_exist and ( not op . isfile ( fname ) ) ) : raise IOError ( ( 'File "%s" does not exist' % fname ) ) if op . isfile ( fname ) : if ( not overwrite ) : raise IOError ( 'Destination file exists. Please use option "overwrite=True" to force overwriting.' ) else : logger . info ( 'Overwriting existing file.' )
check for file existence .