code: def _get_context():
      """Determine the most specific context that we're in.
  
      Returns:
        _CONTEXT_COLAB: If in Colab with an IPython notebook context.
        _CONTEXT_IPYTHON: If not in Colab, but we are in an IPython notebook
          context (e.g., from running `jupyter notebook` at the command
          line).
        _CONTEXT_NONE: Otherwise (e.g., by running a Python script at the
          command-line or using the `ipython` interactive shell).
      """
      # In Colab, the `google.colab` module is available, but the shell
      # returned by `IPython.get_ipython` does not have a `get_trait`
      # method.
      try:
          import google.colab  # noqa: F401
          import IPython
      except ImportError:
          pass
      else:
          if IPython.get_ipython() is not None:
              # We'll assume that we're in a Colab notebook context.
              return _CONTEXT_COLAB
  
      # In an IPython command line shell or Jupyter notebook, we can
      # directly query whether we're in a notebook context.
      try:
          import IPython
      except ImportError:
          pass
      else:
          ipython = IPython.get_ipython()
          if ipython is not None and ipython.has_trait("kernel"):
              return _CONTEXT_IPYTHON
  
      # Otherwise, we're not in a known notebook context.
      return _CONTEXT_NONE
  
imports: import datetime
  import errno
  import html
  import json
  import os
  import random
  import shlex
  import textwrap
  import time
  from tensorboard import manager
label_desc: Use image node_id 1 for calling a global function with example usage: _get_context() and returns: _CONTEXT_NONE, _CONTEXT_COLAB, _CONTEXT_IPYTHON