File and io handling diff

File and IO handling in Py3 is different than Py2

Instead of checking whether isinstance(data, file), since python3 doesn't have the 'file' class, then we check that it is file-like _enough_ to be treated as a file (i.e. it hasattr 'read').

Following advice from http://mail.python.org/pipermail/python-list/2012-November/634704.html

Another choice might be to set `if _util._py3k: file = io._IOBase` and leave the isinstance statement, as _IOBase is the superclass for I/O handling.