[PATCH v2 20/23] python: Refactor build of dictionary entries for py_read_lockspace