What happens if the function of a python thread is completed