rootwrap: improve Python 3 compatibility

Change-Id: I83a7aa7e7ebecb287b0f25e5bf510c10779c4ddf