def execute(context=None, inputs=None, config=None):
    """
    Python语言执行节点
    执行用户提供的Python代码
    """
    try:
        code = config.get('code', '')
        if not code:
            return {"success": False, "error": "没有提供Python代码"}
        
        # 创建执行环境
        exec_globals = {
            'context': context,
            'inputs': inputs,
            'config': config,
            '__builtins__': __builtins__
        }
        exec_locals = {}
        
        # 执行代码
        exec(code, exec_globals, exec_locals)
        
        # 获取输出结果
        output = exec_locals.get('output', '')
        result = exec_locals.get('result', exec_locals)
        
        return {
            "success": True,
            "output": output,
            "result": result,
            "execution_info": {
                "language": "python",
                "code_length": len(code),
                "variables": list(exec_locals.keys())
            }
        }
        
    except Exception as e:
        return {
            "success": False,
            "error": str(e),
            "error_type": type(e).__name__
        }
