Sampling with time limit instead of number of samples

This is quite a general question. Is there a way to setup pm.sample() based on a time limit rather than number of samples? Let’s say I want to be sampling for 4h no matter how many samples I will be able to draw. Is there a way to do that?

This could be related to this open github issue.

However, for specifically not only stopping a trace early, but also saving the current trace early, I do not think there is current functionality for.