def compile_py3k(source, filename, mode, *args, **kwds):
    """
py3k example:
import py3to2; from py3to2 import print_py3k
src = "a, b, *c = 1, 2, 3, 4, 5; print('a =', a); print('b =', b); print('c =', c)"
code_object = py3to2.compile_py3k(src, '', 'exec')
exec(code_object, globals())

"""
    s = "x = compile(%s, %s, %s, *%s, **%s); x = codetree(x).py3to2()"%tuple(repr(x) for x in (source, filename, mode, args, kwds))
    server.input(s)
    x = server.get('x')
    x = eval(x)
    x = x.compile()
    if 1: dis.dis(x)
    return x

py3k example:
import py3to2; from py3to2 import print_py3k
src = "a, b, *c = 1, 2, 3, 4, 5; print('a =', a); print('b =', b); print('c =', c)"
code_object = py3to2.compile_py3k(src, '', 'exec')
exec(code_object, globals())


recipes/Python/574437_py3to2__testdevelopintegrate_pyth30_code/recipe-574437.py