code: def get_pattern_for_span_version(
      pattern: str,
      is_match_span: bool,
      is_match_date: bool,
      is_match_version: bool,
      span: int,
      version: Optional[int],
  ) -> str:
      """Return pattern with Span and Version spec filled."""
      if is_match_span:
          span_token = _make_zero_padding_spec_value(
              SPAN_FULL_REGEX, pattern, span
          )
          pattern = re.sub(SPAN_FULL_REGEX, span_token, pattern)
      elif is_match_date:
          year, month, day = span_number_to_date(span)
          date_tokens = [
              str(year).zfill(4),
              str(month).zfill(2),
              str(day).zfill(2),
          ]
          for spec, value in zip(DATE_SPECS, date_tokens):
              pattern = pattern.replace(spec, value)
      if is_match_version:
          version_token = _make_zero_padding_spec_value(
              VERSION_FULL_REGEX, pattern, version
          )
          pattern = re.sub(VERSION_FULL_REGEX, version_token, pattern)
  
      return pattern
  
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 11 for calling a global function with example usage: get_pattern_for_span_version(pattern, is_match_span, is_match_date, is_match_version, span, version) and returns: pattern