for compatibility with file-like objects