Fix QueryByKeys to support ancestor queries
Add some docstrings and fix a bug in inserting keys into the datastore introduced in an earlier commit