[PATCH v2 19/23] python: Refactor build of dictionary entries for py_get_lockspaces