filter_spec function

Filter a spec object