is possible to implement a physically based lens flares with python?

I know nothing about programming but I was reading this and was wondering if it’s possible to create an addon based on this with python?

Sure anything is possible with Pyhon. Remember 50% of Python is written in C ,a highly optimized language. Python also has direct access to C libraries (DLLs) via ctypes.

So possible , yes, simple , nope.

When you work with graphics its good to understand python, C , linear algebra and of course the libraries you will be using. So be ready for a long ride.