code: def test_search_model_versions_pagination(store):
      def search_versions(
          filter_string, page_token=None, max_results=10
      ):
          result = _search_model_versions(
              store,
              filter_string=filter_string,
              page_token=page_token,
              max_results=max_results,
          )
          return result.to_list(), result.token
  
      name = "test_for_search_MV_pagination"
      store.create_registered_model(name)
      mvs = [_create_model_version(store, name) for _ in range(50)][
          ::-1
      ]
  
      # test flow with fixed max_results
      returned_mvs = []
      query = "name LIKE 'test_for_search_MV_pagination%'"
      result, token = search_versions(
          query, page_token=None, max_results=5
      )
      returned_mvs.extend(result)
      while token:
          result, token = search_versions(
              query, page_token=token, max_results=5
          )
          returned_mvs.extend(result)
      assert mvs == returned_mvs
  
      # test that pagination will return all valid results in sorted order
      # by name ascending
      result, token1 = search_versions(query, max_results=5)
      assert token1 is not None
      assert result == mvs[0:5]
  
      result, token2 = search_versions(
          query, page_token=token1, max_results=10
      )
      assert token2 is not None
      assert result == mvs[5:15]
  
      result, token3 = search_versions(
          query, page_token=token2, max_results=20
      )
      assert token3 is not None
      assert result == mvs[15:35]
  
      result, token4 = search_versions(
          query, page_token=token3, max_results=100
      )
      # assert that page token is None
      assert token4 is None
      assert result == mvs[35:]
  
      # test that providing a completely invalid page token throws
      with pytest.raises(
          MlflowException,
          match=r"Invalid page token, could not base64-decode",
      ) as exception_context:
          search_versions(query, page_token="evilhax", max_results=20)
      assert exception_context.value.error_code == ErrorCode.Name(
          INVALID_PARAMETER_VALUE
      )
  
      # test that providing too large of a max_results throws
      with pytest.raises(
          MlflowException, match=r"Invalid value for max_results."
      ) as exception_context:
          search_versions(query, page_token="evilhax", max_results=1e15)
      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 28 for calling a global function with example usage: test_search_model_versions_pagination(store) and returns: result,  result