Based on a discussion in #ubuntu-devel about a similar issue, I got pointed to io.open() which is available in both Python 2 and 3.
Based on a discussion in #ubuntu-devel about a similar issue, I got pointed to io.open() which is available in both Python 2 and 3.