Every time I see "open(filepath)", I change it into "io.open(filepath, 'rb')" to preserve #python2 behavior. This is fine most of the times; when it's not, it's usually because of some specific business logic you'll have to investigate on anyways. (Similarly, StringIO.StringIO -> io.BytesIO.)
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!