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