File and IO handling in Py3 is different than Py2

Instead of checking whether data isinstance of 'file', then we check that
it is file-like _enough_ to be treated as a file (i.e. it hasattr 'read').