Builtins fix for Python2 and 3

Have added tests, but currently unsure if they could be better!