We seem to be following this pattern a lot.
Why not fold it into pe_find_constraint_resource() ?