请用json格式回答以下用python实现拉格朗日插值的问题，并在回答中添加保持代码的缩进和可读性:
"实现拉格朗日插值的Python代码是什么?"
user
```json
{
    "code": "def lagrange_interpolation(x_data, y_data, x):\n    n = len(x_data)\n    y = 0\n    for i in range(n):\n        L = 1\n        for j in range(n):\n            if i != j:\n                L *= (x - x_data[j]) / (x_data[i] - x_data[j])\n        y += y_data[i] * L\n    return y\n",
    "description": "This Python function implements Lagrange interpolation. It takes three arguments: x_data (list of x-coordinates), y_data (list of y-coordinates), and x (the point at which to estimate the value). The function returns the interpolated value at x."
}
```
assistant