Python2-3 compatability

work in progress, not tested everything