Suppose, I have a method from a third-party library to which I have no access or I don't want to change its source code. I want to be able to call that method and if it doesn't return a result within some period of time, then I want to either cancel its execution or go forward:
# start a timer or something
# call that method
third_party_method()
# if the time has elapsed, say, 1 minute has passed with no result
# then cancel it (preferably)
# and print("too late")
# otherwise print("on time")
How can I do that? Is there an easy more or less and standard way?