def _get_dimension(region):
    """ Return dimensionality of `region` (0, 1, 2, or 3). """
    if len(region) == 7:
        zone_name, imin, imax, jmin, jmax, kmin, kmax = region
    elif len(region) == 5:
        zone_name, imin, imax, jmin, jmax = region
        kmin, kmax = 0, 0
    else:
        zone_name, imin, imax = region
        jmin, jmax, kmin, kmax = 0, 0, 0, 0

    dim = 0
    if imin != imax:
        dim += 1
    if jmin != jmax:
        dim += 1
    if kmin != kmax:
        dim += 1

    return dim