code: def _usage(shorthelp):
      """Writes __main__'s docstring to stdout with some help text.
  
      Args:
        shorthelp: bool, if True, prints only flags from the main module,
            rather than all flags.
      """
      doc = _sys.modules["__main__"].__doc__
      if not doc:
          doc = "\nUSAGE: %s [flags]\n" % _sys.argv[0]
          doc = flags.text_wrap(
              doc, indent="       ", firstline_indent=""
          )
      else:
          # Replace all '%s' with sys.argv[0], and all '%%' with '%'.
          num_specifiers = doc.count("%") - 2 * doc.count("%%")
          try:
              doc %= (_sys.argv[0],) * num_specifiers
          except (OverflowError, TypeError, ValueError):
              # Just display the docstring as-is.
              pass
      if shorthelp:
          flag_str = flags.FLAGS.main_module_help()
      else:
          flag_str = str(flags.FLAGS)
      try:
          _sys.stdout.write(doc)
          if flag_str:
              _sys.stdout.write("\nflags:\n")
              _sys.stdout.write(flag_str)
          _sys.stdout.write("\n")
      except IOError as e:
          # We avoid printing a huge backtrace if we get EPIPE, because
          # "foo.par --help | less" is a frequent use case.
          if e.errno != _errno.EPIPE:
              raise
  
file_path: tensorboard/tensorboard/compat/tensorflow_stub/app.py
imports: import errno
  import sys
  from .None import flags
label_desc: Use image node_id 1 for calling a global function with example usage: _usage(shorthelp) without return types