Handling rtsp interruption python

I’m using the python deepstream 5.0 api.
There is a way to handle rtsp interruption in the stream and set for example a number of retries?
Because now if the stream end it simply close.
Thanks