code: def test_retry_common_errors(tmp_path):
      class MyTuner(gridsearch.GridSearch):
          def __init__(self, *args, **kwargs):
              super().__init__(*args, **kwargs)
              self.count = 0
  
          def run_trial(self, trial, *fit_args, **fit_kwargs):
              self.count += 1
              hp = trial.hyperparameters
              value = hp.Int("value", min_value=1, max_value=5)
              if value in [2, 3]:
                  raise ValueError(f"wrong value {value}.")
              return value
  
      tuner = MyTuner(directory=tmp_path, max_retries_per_trial=2)
      tuner.search()
      assert tuner.count == 5 + 2 * 2
  
imports: import os
  import pickle
  import time
  import numpy
  import pytest
  from sklearn import linear_model
  import keras_tuner
  from keras_tuner import errors
  from keras_tuner.distribute import oracle_client
  from keras_tuner.engine import base_tuner
  from keras_tuner.test_utils import mock_distribute
  from keras_tuner.tuners import gridsearch
  from keras_tuner.tuners import randomsearch
label_desc: Use image node_id 4 for calling a global function with example usage: test_retry_common_errors(tmp_path) and returns: value