finish draft version of temporal/src/query-opt-ent.py