How can I model an optical filter using python?
Yes, you can. 

There are a great number of parallels between (certain) microwave filters and (certain) optical filters based on impedance concepts.
This section of a video can illustrate this:
https://youtu.be/pLl3q6WKtxw?t=2346

Both optical and RF signals and filters can be modeled with complex amplitude/phase responses VS frequency, and so you can use all the same mathematical ideas to model the impact of both in the same way.