Add a compatibility patch for Python 2/3

* Map unicode() to str() in Python 3 to dodge NameErrors
  while maintaining functionality.