code: def parse_sagemaker_version() -> str:
      """Returns sagemaker library version. This should only be called once.
  
      Function reads ``__version__`` variable in ``sagemaker`` module.
      In order to maintain compatibility with the ``packaging.version``
      library, versions with fewer than 2, or more than 3, periods are rejected.
      All versions that cannot be parsed with ``packaging.version`` are also
      rejected.
  
      Raises:
          RuntimeError: If the SageMaker version is not readable. An exception is also raised if
          the version cannot be parsed by ``packaging.version``.
      """
      version = sagemaker.__version__
      parsed_version = None
  
      num_periods = version.count(".")
      if num_periods == 2:
          parsed_version = version
      elif num_periods == 3:
          trailing_period_index = version.rfind(".")
          parsed_version = version[:trailing_period_index]
      else:
          raise RuntimeError(
              f"Bad value for SageMaker version: {sagemaker.__version__}"
          )
  
      Version(parsed_version)
  
      return parsed_version
  
imports: from __future__ import absolute_import
  import logging
  import os
  from typing import Any, Dict, List, Optional, Union
  from urllib.parse import urlparse
  import boto3
  from packaging.version import Version
  import sagemaker
  from sagemaker.config.config_schema import MODEL_ENABLE_NETWORK_ISOLATION_PATH, MODEL_EXECUTION_ROLE_ARN_PATH, TRAINING_JOB_ENABLE_NETWORK_ISOLATION_PATH, TRAINING_JOB_INTER_CONTAINER_ENCRYPTION_PATH, TRAINING_JOB_ROLE_ARN_PATH
  from sagemaker.jumpstart import constants, enums
  from sagemaker.jumpstart import accessors
  from sagemaker.s3 import parse_s3_url
  from sagemaker.jumpstart.exceptions import DeprecatedJumpStartModelError, VulnerableJumpStartModelError, get_old_model_version_msg
  from sagemaker.jumpstart.types import JumpStartModelHeader, JumpStartModelSpecs, JumpStartVersionedModelId
  from sagemaker.session import Session
  from sagemaker.config import load_sagemaker_config
  from sagemaker.utils import resolve_value_from_config, TagsDict
  from sagemaker.workflow import is_pipeline_variable
label_desc: Use image node_id 6 for calling a global function with example usage: parse_sagemaker_version() and returns: parsed_version