'Controls the time allocated for the execution of a method'

def _timeout(self, timeout, handler, *args, **kwargs):

    t = spawn_thread(target=handler, args=args, kwargs=kwargs)
    t.daemon = True
    t.start()
    t.join(timeout)
    if (not t.is_alive()):
        if t.exc_info:
            return t.exc_info
        return t.result
    else:
        try:
            msg = '[%s]    Execution    was    forcefully    terminated'
            raise RuntimeError((msg % t.name))
        except:
            return sys.exc_info()
