def hy_compile(tree, module_name, root=ast.Module, get_expr=False):
 body = []
 expr = None
 if tree:
  compiler = HyASTCompiler(module_name)
  result = compiler.compile(tree)
  expr = result.force_expr
  if (not get_expr):
   result += result.expr_as_stmt()
  if isinstance(tree, list):
   spoof_tree = tree[0]
  else:
   spoof_tree = tree
  body = (compiler.imports_as_stmts(spoof_tree) + result.stmts)
 ret = root(body=body)
 if get_expr:
  expr = ast.Expression(body=expr)
  ret = (ret, expr)
 return ret

def hy_compile ( tree , module_name , root = ast . Module , get_expr = False ) : body = [ ] expr = None if tree : compiler = HyASTCompiler ( module_name ) result = compiler . compile ( tree ) expr = result . force_expr if ( not get_expr ) : result += result . expr_as_stmt ( ) if isinstance ( tree , list ) : spoof_tree = tree [ 0 ] else : spoof_tree = tree body = ( compiler . imports_as_stmts ( spoof_tree ) + result . stmts ) ret = root ( body = body ) if get_expr : expr = ast . Expression ( body = expr ) ret = ( ret , expr ) return ret
compile a hyobject tree into a python ast module .