Prevent student to access LMS content after subscription ends

Is there a way to disable student access to LMS content after subscription period ends?

I am making subscription access for informal education institute. Our client will allow a student to a program for certain duration (Program enrollment doctype will allow student to access the LMS content for that program), but I don’t know how to stop student access to a program after their subscription ends.

I have tried using student exit date, but student still able to access the program LMS.

That would require some coding on backend
Python file (on the lms permission )

Check here:

https://github.com/frappe/erpnext/blob/develop/erpnext/education/utils.py