docs: def start(logdir):
      """Start a TensorBoard instance.
  
      Args:
        logdir: the logdir to run TensorBoard on.
      Raises:
        Exception if the instance cannot be started.
      """
      if logdir.startswith('gs://'):
        # Check user does have access. TensorBoard will start successfully regardless
        # the user has read permissions or not so we check permissions here to
        # give user alerts if needed.
        datalab.storage._api.Api.verify_permitted_to_read(logdir)
  
      port = datalab.utils.pick_unused_port()
      args = ['tensorboard', '--logdir=' + logdir, '--port=' + str(port)]
      p = subprocess.Popen(args)
      retry = 10
      while (retry > 0):
        if datalab.utils.is_http_running_on(port):
          basepath = os.environ.get('DATALAB_ENDPOINT_URL', '')
          url = '%s/_proxy/%d/' % (basepath.rstrip('/'), port)
          html = '<p>TensorBoard was started successfully with pid %d. ' % p.pid
          html += 'Click <a href="%s" target="_blank">here</a> to access it.</p>' % url
          IPython.display.display_html(html, raw=True)
          return p.pid
        time.sleep(1)
        retry -= 1
  
      raise Exception('Cannot start TensorBoard.')