Timeout function if it takes too long to finish

I have a shell script that loops through a text file containing URL:s that I want to visit and take screenshots of.

All this is done and simple. The script initializes a class that when run creates a screenshot of each site in the list. Some sites take a very, very long time to load, and some might not be loaded at all. So I want to wrap the screengrabber-function in a timeout script, making the function return

False

if it couldn't finish within 10 seconds.

I'm content with the simplest solution possible, maybe setting a asynchronous timer that will return False after 10 seconds no matter what actually happens inside the function?