importing StringIO and BytesIO from six