code: def crop_2dimage(img, beg_coords, end_coords):
      
  
      cropped_img = img[
                    beg_coords[0]:end_coords[0],
                    beg_coords[1]:end_coords[1],
                    ]
  
      return cropped_img
docs: Crops a 3d image to the bounding box specified.