You need to import basestring from xray.pycompat to make this work on Python 3.