add py3compat.buffer_to_bytes_py2

casts buffer-providing objects to bytes

needed for pickle.loads on buffers
cast buffers to bytes on Python 2 for pickle.loads

pickle.loads doesn't support the buffer interface on Python 2
Merge pull request #7105 from minrk/pickle-np-obj-py2

add py3compat.buffer_to_bytes_py2