Change preview to use BytesIO instead of StringIO

This fixes it to work in Python 3. Since BytesIO is available in Python 2.6,
the use of StringIO has been deprecated. See
https://code.google.com/p/sympy/issues/detail?id=3984.

This fixes, in particular, init_printing(use_latex='png') in Python 3.
Merge branch 'master' into preview_bytesio

Conflicts:
	sympy/interactive/printing.py
Fix Piecewise._sort_expr_cond for Relational conditions.
XFAIL a integration test: the actual answer should be 1/2.
Merge pull request #2398 from asmeurer/preview_bytesio

Change preview to use BytesIO instead of StringIO
Merge pull request #2585 from jrioux/piecewise

Piecewise integration fix