def _check_newline(prefix, file_name, keep_newline):
 if isinstance(keep_newline, bool):
  return (not keep_newline)
 full_path = os.path.join(prefix, file_name)
 for pattern in keep_newline:
  try:
   if fnmatch.fnmatch(full_path, pattern):
    return False
  except TypeError:
   if fnmatch.fnmatch(full_path, str(pattern)):
    return False
 return True

def _check_newline ( prefix , file_name , keep_newline ) : if isinstance ( keep_newline , bool ) : return ( not keep_newline ) full_path = os . path . join ( prefix , file_name ) for pattern in keep_newline : try : if fnmatch . fnmatch ( full_path , pattern ) : return False except TypeError : if fnmatch . fnmatch ( full_path , str ( pattern ) ) : return False return True
return a boolean stating whether or not a files trailing newline should be removed .