code: def test_set_model_version_tag(store):
      name1 = "SetModelVersionTag_TestMod"
      name2 = "SetModelVersionTag_TestMod 2"
      initial_tags = [
          ModelVersionTag("key", "value"),
          ModelVersionTag("anotherKey", "some other value"),
      ]
      store.create_registered_model(name1)
      store.create_registered_model(name2)
      run_id_1 = uuid.uuid4().hex
      run_id_2 = uuid.uuid4().hex
      run_id_3 = uuid.uuid4().hex
      store.create_model_version(name1, "A/B", run_id_1, initial_tags)
      store.create_model_version(name1, "A/C", run_id_2, initial_tags)
      store.create_model_version(name2, "A/D", run_id_3, initial_tags)
      new_tag = ModelVersionTag("randomTag", "not a random value")
      store.set_model_version_tag(name1, 1, new_tag)
      all_tags = [*initial_tags, new_tag]
      rm1mv1 = store.get_model_version(name1, 1)
      assert rm1mv1.tags == {tag.key: tag.value for tag in all_tags}
  
      # test overriding a tag with the same key
      overriding_tag = ModelVersionTag("key", "overriding")
      store.set_model_version_tag(name1, 1, overriding_tag)
      all_tags = [tag for tag in all_tags if tag.key != "key"] + [
          overriding_tag
      ]
      rm1mv1 = store.get_model_version(name1, 1)
      assert rm1mv1.tags == {tag.key: tag.value for tag in all_tags}
      # does not affect other model versions with the same key
      rm1mv2 = store.get_model_version(name1, 2)
      rm2mv1 = store.get_model_version(name2, 1)
      assert rm1mv2.tags == {tag.key: tag.value for tag in initial_tags}
      assert rm2mv1.tags == {tag.key: tag.value for tag in initial_tags}
  
      # can not set tag on deleted (non-existed) model version
      store.delete_model_version(name1, 2)
      with pytest.raises(
          MlflowException,
          match=rf"Model Version \(name={name1}, version=2\) not found",
      ) as exception_context:
          store.set_model_version_tag(name1, 2, overriding_tag)
      assert exception_context.value.error_code == ErrorCode.Name(
          RESOURCE_DOES_NOT_EXIST
      )
      # test cannot set tags that are too long
      long_tag = ModelVersionTag("longTagKey", "a" * 5001)
      with pytest.raises(
          MlflowException,
          match=r"Model version value '.+' had length \d+, which exceeded length limit of 5000",
      ) as exception_context:
          store.set_model_version_tag(name1, 1, long_tag)
      assert exception_context.value.error_code == ErrorCode.Name(
          INVALID_PARAMETER_VALUE
      )
      # test can set tags that are somewhat long
      long_tag = ModelVersionTag("longTagKey", "a" * 4999)
      store.set_model_version_tag(name1, 1, long_tag)
      # can not set invalid tag
      with pytest.raises(
          MlflowException, match=r"Tag name cannot be None"
      ) as exception_context:
          store.set_model_version_tag(
              name2, 1, ModelVersionTag(key=None, value="")
          )
      assert exception_context.value.error_code == ErrorCode.Name(
          INVALID_PARAMETER_VALUE
      )
      # can not use invalid model name or version
      with pytest.raises(
          MlflowException,
          match=r"Registered model name cannot be empty",
      ) as exception_context:
          store.set_model_version_tag(
              None, 1, ModelVersionTag(key="key", value="value")
          )
      assert exception_context.value.error_code == ErrorCode.Name(
          INVALID_PARAMETER_VALUE
      )
      with pytest.raises(
          MlflowException, match=r"Model version must be an integer"
      ) as exception_context:
          store.set_model_version_tag(
              name2,
              "I am not a version",
              ModelVersionTag(key="key", value="value"),
          )
      assert exception_context.value.error_code == ErrorCode.Name(
          INVALID_PARAMETER_VALUE
      )
  
imports: import time
  import uuid
  from typing import List, NamedTuple
  from unittest import mock
  import pytest
  from mlflow.entities.model_registry import ModelVersion, ModelVersionTag, RegisteredModelTag
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE, RESOURCE_DOES_NOT_EXIST, ErrorCode
  from mlflow.store.model_registry.file_store import FileStore
  from mlflow.utils.file_utils import path_to_local_file_uri, write_yaml
  from mlflow.utils.time import get_current_time_millis
  from tests.helper_functions import random_int, random_str
label_desc: Use image node_id 37 for calling a global function with example usage: test_set_model_version_tag(store) without return types