docs: def compile_to_python(exp, env, done=None): 
    '''assemble steps from dao expression to python code'''
    original_exp = exp
    compiler = Compiler()
    if done is None:
      done = il.Done(compiler.new_var(il.ConstLocalVar('v')))
    compiler.exit_block_cont_map = {}
    compiler.continue_block_cont_map = {}
    compiler.protect_cont = done
    if env is None: env = Environment()
    exp = element(exp)
    exp = exp.alpha(env, compiler)
    exp = exp.cps(compiler, done)
    exp.analyse(compiler)
    env = Environment()
    exp = exp.optimize(env, compiler)
    #exp = exp.tail_recursive_convert()
    function = compiler.new_var(il.ConstLocalVar('compiled_dao_function'))
    exp = il.Function(function, (), exp)
    exp = il.begin(*exp.pythonize(env, compiler)[0])
    if isinstance(exp, il.Begin):
      exp = exp.statements[0]
    exp.body = exp.body.replace_return_with_yield()
    compiler = Compiler()
    result = exp.to_code(compiler)
    return prelude + result