title: equivalent of getbuffer for BytesIO in Python 2
body: <p>In Python 3, I can get the size of a ByteIO object via <code>object.getbuffer().nbytes</code> (where <code>object = ByteIO()</code>), but what would be the best equivalent for <code>getbuffer()</code> in Python 2? Doing some exploring, I found out I can use <code>len(object.getvalue())</code> or <code>sys.getsizeof(object)</code>, but I don't know if Python 2 will accept them.</p>