# for part in data:
# print(type(part))
# print(part)
# if not isinstance(part, (bytes, bytearray, memoryview)):
# raise TypeError('data argument must be iterable of '
# 'byte-ish (%r)' % data)
# data_len = sum(len(part) for part in str(data,"ascii"))
if not isinstance(data, (bytes, bytearray, memoryview)):
raise TypeError('data argument must be iterable of '
'byte-ish (%r)' % data)
data_len = len(data)
cannot write in 3.6
core.py line 287