def remove_padding(im, pad):
    """
    Function for removing padding from an image.
    :param im: image to remove padding from
    :param pad: number of pixels of padding to remove
    :return:
    """

    return im[pad:-pad, pad:-pad]