def is_obs_valid(obs, max_plate_z):
    """
    Checks if the given observation is a valid observation.
    """

    z_g = obs.g_pos.value
    theta = obs.theta.value

    if z_g == 0 or z_g > max_plate_z:
        return theta == 'N'
    elif z_g == 1:
        return theta != 'N'
    else:
        return True