def rescale(pyr, scale_base):
  """Rescale a wavelet decomposition `pyr` by `scale_base`^level.

  Args:
    pyr: A wavelet decomposition produced by construct().
    scale_base: The base of the exponentiation used for the per-level scaling.

  Returns:
    pyr where each level has been scaled by `scale_base`^level. The first
    level is 0 and is therefore not scaled.
  """
  pyr_norm = []
  for d in range(len(pyr) - 1):
    level_norm = []
    scale = scale_base**d
    for b in range(3):
      level_norm.append(pyr[d][b] * scale)
    pyr_norm.append(level_norm)
  d = len(pyr) - 1
  scale = scale_base**d
  pyr_norm.append(pyr[d] * scale)
  return pyr_norm