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

    x_g = obs.g_pos.value
    theta = obs.theta.value

    if (x_g == 0) or (x_g > max_book_x):
        return theta == 'N'
    else:
        return theta != 'N'