def is_binary_file(file_name):
    """
    Tries to open file in text mode and read first 64 bytes. If it fails,
    we can be fairly certain, this is due to the file being binary encoded.
    Thanks Sehrii https://stackoverflow.com/a/51495076/949561 for the help.
    """
    try:
        with open(file_name, 'tr') as check_file:
            check_file.read(32)
            return False
    except:
        return True