simpler python2 compatibility for davinci code