def is_bin_str(data):
    if '\0' in data:
        return True
    if not data:
        return False

    text_characters = ''.join([chr(x) for x in range(32, 127)] + list('\n\r\t\b'))
    # Get the non-text characters (map each character to itself then use the
    # 'remove' option to get rid of the text characters.)
    if six.PY3:
        trans = ''.maketrans('', '', text_characters)
        nontext = data.translate(trans)
    else:
        trans = string.maketrans('', '')
        nontext = data.translate(trans, text_characters)

    # If more than 30% non-text characters, then
    # this is considered a binary file
    if len(nontext) / len(data) > 0.30:
        return True
    return False
Instantiate the driver with the given API key
dataset/ETHPy150Open saltstack/salt/salt/utils/__init__.py/is_bin_str--crossover with--dataset/ETHPy150Open cloudkick/libcloud/libcloud/compute/drivers/linode.py/LinodeNodeDriver.__init__