I am trying to look for a Python function that is the same as MATLAB's 'fit' function.

Specifically I am looking for something similar to the following MATLAB code:

```
fi = fit(bins, z, cubicinterp) 

```

where z and bins are lists.