def text_message(self, msg):
    user = User.get_or_insert(msg.sender)
if not user.partner:
    other = db.Query(User).filter('partner =', None).fetch(2)
other = [u for u in other if u.key() != user.key()]
Query for model by key