Import py3kcompat module from oslo-incubator

The code is pulled from 24a3c82d06574a4a239af566234065c4179cbf47.

This is added so that it can be used in [1].

[1] https://review.openstack.org/#/c/57023/

Change-Id: Ibd0f527ab6673df9b95bfa8ea5302073607ee498
Merge "Import py3kcompat module from oslo-incubator"