python: Refactor build of dictionary entries for py_read_resource
Use Py_BuildValue("{...}",...) for creating dictionary information
for resource.
Using helper to determine the build value format:
- Py2: Handle lockspace and resource name as PyString with "s" format.
- Py3: Handle lockspace and resource name as PyBytes with "y" format.
Current status:
- Py2: will build and pass tests.
- Py3: build will fail for missing respective API calls.