Simplify ndb queries for building dict of client IDs