interruptingcow is a generic Python utility that can relatively gracefully interrupt your code when it doesn't execute within a specific number of seconds:from interruptingcow import timeouttry: with timeout(5): # perform a potentially very slow...