why not replace the above two lines with
```kwargs = {'provider': provider}```