Added in a check for the 'getbuffer' attribute for the BytesIO object. It will default to the 'getvalue' attribute if not found, which is the attribute compatable with Python2.7.
Removed 'utf-8' formatting when adding the file size info to the buffer. Python2.7 doesn't support multiple arguments to bytes().
Lastly, added in a check for the 'buffer' attribute for sys.stdout. It will default to sys.stdout.write if not found. These changes seem to provide support for Python2.7 and maintains Python3.
Added in a check for the 'getbuffer' attribute for the BytesIO object. It will default to the 'getvalue' attribute if not found, which is the attribute compatable with Python2.7.
Removed 'utf-8' formatting when adding the file size info to the buffer. Python2.7 doesn't support multiple arguments to bytes().
Lastly, added in a check for the 'buffer' attribute for sys.stdout. It will default to sys.stdout.write if not found. These changes seem to provide support for Python2.7 and maintains Python3.