code: def parse_model_path(
      model_path: str, expected_model_name: Optional[str] = None
  ) -> Tuple[str, str, int]:
      """Parse model_path into parts of TFS flavor.
  
      Args:
        model_path: A TFS-flavored model path.
        expected_model_name: Expected model_name as defined from the module
            docstring. If model_name does not match, parsing will be failed.
  
      Raises:
        ValueError: If model path is invalid (not TFS-flavored).
  
      Returns:
        Tuple of (model_base_path, model_name, version)
      """
      rest, version = os.path.split(model_path)
      if not rest:
          raise ValueError(
              "model_path is too short ({})".format(model_path)
          )
      if not version.isdigit():
          raise ValueError("No version segment ({})".format(model_path))
      version = int(version)
  
      model_base_path, model_name = os.path.split(rest)
      if (
          expected_model_name is not None
          and model_name != expected_model_name
      ):
          raise ValueError(
              "model_name does not match (expected={}, actual={})".format(
                  expected_model_name, model_path
              )
          )
  
      return model_base_path, model_name, version
  
imports: import os
  from typing import Optional, Tuple
label_desc: Use image node_id 2 for calling a global function with example usage: parse_model_path(model_path, expected_model_name) and returns: model_base_path,  model_name,  version