human
I wrote the below code

    if (_ST3 or (threading.current_thread().getName() == 'MainThread')):
        return func()
    condition = threading.Condition()
    condition.acquire()
    def _get_result():
        with condition:
            _get_result.result = func()
            condition.notify()
    sublime.set_timeout(_get_result, 0)
    condition.wait(timeout)
    if (not hasattr(_get_result, 'result')):
        if (default_value is __sentinel__):
            raise TimeoutError('Timeout    while    waiting    for    {0}'.format(func))
        else:
            return default_value
    return _get_result.result

What's a good function header?
 Here's a good function header?
assistant
#Here's a good function header.

def run_on_main_thread(func, timeout=10, default_value=__sentinel__):