code: def _sampling_strategy_dict(sampling_strategy, y, sampling_type):
      """Returns sampling target by converting the dictionary depending of the
      sampling."""
      target_stats = _count_class_sample(y)
      # check that all keys in sampling_strategy are also in y
      set_diff_sampling_strategy_target = set(
          sampling_strategy.keys()
      ) - set(target_stats.keys())
      if len(set_diff_sampling_strategy_target) > 0:
          raise ValueError(
              f"The {set_diff_sampling_strategy_target} target class is/are not "
              f"present in the data."
          )
      # check that there is no negative number
      if any(n_samples < 0 for n_samples in sampling_strategy.values()):
          raise ValueError(
              f"The number of samples in a class cannot be negative."
              f"'sampling_strategy' contains some negative value: {sampling_strategy}"
          )
      sampling_strategy_ = {}
      if sampling_type == "over-sampling":
          n_samples_majority = max(target_stats.values())
          class_majority = max(target_stats, key=target_stats.get)
          for class_sample, n_samples in sampling_strategy.items():
              if n_samples < target_stats[class_sample]:
                  raise ValueError(
                      f"With over-sampling methods, the number"
                      f" of samples in a class should be greater"
                      f" or equal to the original number of samples."
                      f" Originally, there is {target_stats[class_sample]} "
                      f"samples and {n_samples} samples are asked."
                  )
              if n_samples > n_samples_majority:
                  warnings.warn(
                      f"After over-sampling, the number of samples ({n_samples})"
                      f" in class {class_sample} will be larger than the number of"
                      f" samples in the majority class (class #{class_majority} ->"
                      f" {n_samples_majority})",
                      stacklevel=1,
                  )
              sampling_strategy_[class_sample] = (
                  n_samples - target_stats[class_sample]
              )
      elif sampling_type == "under-sampling":
          for class_sample, n_samples in sampling_strategy.items():
              if n_samples > target_stats[class_sample]:
                  raise ValueError(
                      f"With under-sampling methods, the number of"
                      f" samples in a class should be less or equal"
                      f" to the original number of samples."
                      f" Originally, there is {target_stats[class_sample]} "
                      f"samples and {n_samples} samples are asked."
                  )
              sampling_strategy_[class_sample] = n_samples
      elif sampling_type == "clean-sampling":
          raise ValueError(
              "'sampling_strategy' as a dict for cleaning methods is "
              "not supported. Please give a list of the classes to be "
              "targeted by the sampling."
          )
      else:
          raise NotImplementedError
  
      return sampling_strategy_
  
imports: import warnings
  from collections import OrderedDict
  from functools import wraps
  from inspect import Parameter, signature
  from numbers import Real
  from typing import Any, Dict
  import numpy
  from sklearn.utils import column_or_1d
  from sklearn.utils.multiclass import type_of_target
label_desc: Use image node_id 8 for calling a global function with example usage: _sampling_strategy_dict(sampling_strategy, y, sampling_type) and returns: sampling_strategy_