code: def tf():
    
    try:
      from tensorboard.compat import notf  # pylint: disable=g-import-not-at-top
    except ImportError:
      try:
        import tensorflow  # pylint: disable=g-import-not-at-top
        return tensorflow
      except ImportError:
        pass
    from tensorboard.compat import tensorflow_stub  # pylint: disable=g-import-not-at-top
    return tensorflow_stub
docs: Provide the root module of a TF-like API for use within TensorBoard.
  
    By default this is equivalent to `import tensorflow as tf`, but it can be used
    in combination with //tensorboard/compat:tensorflow (to fall back to a stub TF
    API implementation if the real one is not available) or with
    //tensorboard/compat:no_tensorflow (to force unconditional use of the stub).
  
    Returns:
      The root module of a TF-like API, if available.
  
    Raises:
      ImportError: if a TF-like API is not available.