code: def is_mainthread(thread=None):
      '''Check if thread is the main thread.
  
      If ``thread`` is not supplied check the current thread
      '''
      thread = thread if thread is not None else current_thread()
      return isinstance(thread, threading._MainThreadf is_mainthread(thread=None):
      '''Check if thread is the main thread.
  
      If ``thread`` is not supplied check the current thread
      '''
      thread = thread if thread is not None else current_thread()
      return isinstance(thread, threading._MainThread)
docs: Check if thread is the main thread.
  
      If ``thread`` is not supplied check the current thread