code: def depolarize(mat, rates, num_wires, level):
      """Apply effect of depolarizing noise in circuit to kernel matrix."""
      if level == "per_circuit":
          noisy_mat = (1 - rates) * mat + rates / (
              2**num_wires
          ) * np.ones_like(mat)
      elif level == "per_embedding":
          noisy_mat = np.copy(mat)
          for i in range(len(mat)):
              for j in range(i, len(mat)):
                  rate = rates[i] + rates[j] - rates[i] * rates[j]
                  noisy_mat[i, j] *= 1 - rate
                  noisy_mat[i, j] += rate / (2**num_wires)
  
      return noisy_mat
  
imports: import math
  import sys
  from functools import partial
  import pytest
  import numpy
  import pennylane
  import pennylane.kernels
  from pennylane import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: depolarize(mat, rates, num_wires, level) and returns: noisy_mat