<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def display_arr(screen, arr, video_size, transpose):
 """ Display an image to the pygame screen. Args: screen (pygame.Surface):
 the pygame surface to write frames to arr (np.ndarray):
 numpy array representing a single frame of gameplay video_size (tuple):
 the size to render the frame as transpose (bool):
 whether to transpose the frame before displaying Returns: None """

    # take the transpose if necessary
    if transpose:
        pyg_img = pygame.surfarray.make_surface(arr.swapaxes(0, 1))
    else:
        pyg_img = arr
    # resize the image according to given image size
    pyg_img = pygame.transform.scale(pyg_img, video_size)
    # blit the image to the surface
    screen.blit(pyg_img, (0, 0))