def downsample(image, factor=2):
  """
  Downsample an image by the provided factor

  Parameters
  ----------
  image : ndarray(float32 or uint8, size=(h, w, c))
      The image to be filtered. The filter is applied to each color
      channel independently.
  factor : int, optional
      Take every Nth sample in each dimension, where N==factor

  Returns
  -------
  downsampled_image : ndarray(float32 or uint8, size=(h_d, w_d, c))
      The size of the downsampled image is h_d = ceil(h / factor),
      w_d = ceil(w / factor).
  """
  assert type(factor) == int
  return image[::factor, ::factor]