code: def toplevelTryFunc(func, *args, **kwargs):
          'Thread entry-point for `func(*args, **kwargs)` with try/except wrapper'
          t = threading.current_thread()
          t.name = func.__name__
          ret = None
          try:
              ret = func(*args, **kwargs)
          except EscapeException as e:  # user aborted
              t.status += 'aborted by user'
              status('%s aborted' % t.name, priority=2)
          except Exception as e:
              t.exception = e
              exceptionCaught(e)
  
          if t.sheet:
              t.sheet.currentThreads.remove(t)
          return ref toplevelTryFunc(func, *args, **kwargs):
          'Thread entry-point for `func(*args, **kwargs)` with try/except wrapper'
          t = threading.current_thread()
          t.name = func.__name__
          ret = None
          try:
              ret = func(*args, **kwargs)
          except EscapeException as e:  # user aborted
              t.status += 'aborted by user'
              status('%s aborted' % t.name, priority=2)
          except Exception as e:
              t.exception = e
              exceptionCaught(e)
  
          if t.sheet:
              t.sheet.currentThreads.remove(t)
          return ret
docs: Thread entry-point for `func(*args, **kwargs)` with try/except wrapper