def borders_flipped(array):
    """ Return true if any of the border elements are flipped.
    """
    return  array[0,:,:].any() or array[-1,:,:].any() or array[:,0,:].any() or array[:,-1,:].any() or array[:,:,0].any() or array[:,:,-1].any()