Use EAFP instead of hasattr() to check o.fileno

This will allow files being extracted via the tarfile module to be uploaded directly, without wrapping them in another file-like object.