code: def test_tb_valid_presigned_kwargs(mock_init, mock_client):
      mock_init.return_value = None
      resp = {
          "ResponseMetadata": {"HTTPStatusCode": 200},
          "AuthorizedUrl": TEST_PRESIGNED_URL,
      }
      mock_client = boto3.client("sagemaker")
      mock_client.create_presigned_domain_url = Mock(
          name="create_presigned_domain_url"
      )
      mock_client.create_presigned_domain_url.return_value = resp
  
      tb_app = TensorBoardApp(TEST_REGION)
      tb_app.region = TEST_REGION
      tb_app._domain_id = None
      tb_app._user_profile_name = None
      tb_app._in_studio_env = False
      tb_app._sagemaker_client = boto3.client(
          "sagemaker", region_name=TEST_REGION
      )
  
      valid_kwargs = {"ExpiresInSeconds": 1500}
      tb_app.get_app_url(
          create_presigned_domain_url=True,
          domain_id=TEST_DOMAIN,
          user_profile_name=TEST_USER_PROFILE,
          open_in_default_web_browser=False,
          optional_create_presigned_url_kwargs=valid_kwargs,
      )
      mock_client.create_presigned_domain_url.assert_called_with(
          **valid_kwargs
      )
  
      # test url when opened in web browser
      with patch("webbrowser.open") as mock_web_browser_open:
          url = tb_app.get_app_url(
              domain_id=TEST_DOMAIN,
              user_profile_name=TEST_USER_PROFILE,
              create_presigned_domain_url=True,
              open_in_default_web_browser=True,
          )
          mock_web_browser_open.assert_called_with(
              f"{TEST_PRESIGNED_URL}&redirect=TensorBoard"
          )
          assert url == ""
  
imports: from __future__ import absolute_import
  import json
  from unittest.mock import patch, Mock, mock_open, PropertyMock
  import boto3
  import botocore
  import pytest
  from sagemaker.interactive_apps.tensorboard import TensorBoardApp
label_desc: Use image node_id 17 for calling a global function with example usage: test_tb_valid_presigned_kwargs(mock_init, mock_client) without return types