python: Wrap file-like objects on demand.