code: def _find_matched_span_version_from_path(
      file_path: str,
      split_regex_pattern: str,
      is_match_span: bool,
      is_match_date: bool,
      is_match_version: bool,
  ) -> Tuple[
      Optional[List[str]], Optional[int], Optional[str], Optional[int]
  ]:
      """Finds the span tokens and number given a file path and split regex."""
  
      result = re.search(split_regex_pattern, file_path)
      if result is None:
          raise ValueError("Glob pattern does not match regex pattern")
  
      matched_span_tokens = None
      matched_span_int = None
      matched_version = None
      matched_version_int = None
  
      if is_match_span:
          matched_span_tokens = [result.group(SPAN_PROPERTY_NAME)]
          try:
              matched_span_int = int(matched_span_tokens[0])
          except ValueError:
              raise ValueError(
                  "Cannot find %s number from %s based on %s"
                  % (SPAN_PROPERTY_NAME, file_path, split_regex_pattern)
              )
      elif is_match_date:
          matched_span_tokens = [
              result.group(name) for name in ["year", "month", "day"]
          ]
          try:
              matched_span_ints = [
                  int(elem) for elem in matched_span_tokens
              ]
          except ValueError:
              raise ValueError(
                  "Cannot find %s number using date from %s based on %s"
                  % (SPAN_PROPERTY_NAME, file_path, split_regex_pattern)
              )
          try:
              matched_span_int = date_to_span_number(*matched_span_ints)
          except ValueError:
              raise ValueError(
                  "Retrieved date is invalid for file: %s" % file_path
              )
  
      if is_match_version:
          matched_version = result.group(VERSION_PROPERTY_NAME)
          try:
              matched_version_int = int(matched_version)
          except ValueError:
              raise ValueError(
                  "Cannot find %s number from %s based on %s"
                  % (
                      VERSION_PROPERTY_NAME,
                      file_path,
                      split_regex_pattern,
                  )
              )
  
      return (
          matched_span_tokens,
          matched_span_int,
          matched_version,
          matched_version_int,
      )
  
imports: import datetime
  import os
  import re
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  from absl import logging
  import numpy
  from tfx.dsl.io import fileio
  from tfx.proto import example_gen_pb2
  from tfx.proto import range_config_pb2
  from tfx.utils import io_utils
  from google.protobuf import json_format
  from tensorflow.core.example import example_pb2
  from tensorflow.core.example import feature_pb2
label_desc: Use image node_id 13 for calling a global function with example usage: _find_matched_span_version_from_path(file_path, split_regex_pattern, is_match_span, is_match_date, is_match_version) and returns: matched_span_tokens,  matched_span_int,  matched_version,  matched_version_int