How to call self defined function in sequencer by python

How to call self defined function in sequencer by python?
I am writing sequencer rendering using python, i want to know can i call defined function by key frame ?(maybe by event track)?