def _is_text_file(filename):
 type_of_file = os.popen('file -bi {0}'.format(filename), 'r').read()
 return type_of_file.startswith('text')

def _is_text_file ( filename ) : type_of_file = os . popen ( 'file -bi {0}' . format ( filename ) , 'r' ) . read ( ) return type_of_file . startswith ( 'text' )
checks if a file is a text file .