Returns if given file is a binary file.

    :param file: File path.
    :type file: unicode
    :return: Is file binary.
    :rtype: bool

def is_binary_file(file):
    """
    Returns if given file is a binary file.

    :param file: File path.
    :type file: unicode
    :return: Is file binary.
    :rtype: bool
    """

    file_handle = open(file, "rb")
    try:
        chunk_size = 1024
        while True:
            chunk = file_handle.read(chunk_size)
            if chr(0) in chunk:
                return True
            if len(chunk) < chunk_size:
                break
    finally:
        file_handle.close()
    return False