LibreOffice wiping object properties (Issue with GalleryThemeProvider)

I create a bug report:

tdf#151932 for this issue.

I am having a challenge getting as Gallery ( XGalleryItem ) Item to be passed outside a function in python.

Inside the find_gallery_item() function I call the report_gallery_item() on line 238
Everything works as expected. As shown in Figure 2 and Figure 4.
In short I can access the full Gallery Item properties, Figure 2 shows the output.

As soon and the function return the result the properties are altered ( wiped ).
The output of Gallery.report_gallery_item(itm) is show in Figure 3.
In short the properties have gone away.

I need help returning XGalleryItem from a function so I can pass it to other functions such as get_gallery_graphic()

Does anyone know a solution for this?

Figure 1: Snippet from Gallery info sample

itm = Gallery.find_gallery_item(
	GalleryKind.DIAGRAMS,
	"Pyramid-Fancy",
	search_match=SearchMatchKind.FULL,
	search_kind=SearchByKind.TITLE,
)
Gallery.report_gallery_item(itm)

Figure 2: Normal results

Searching gallery "Diagrams" for "Pyramid-Fancy"
  Search is case sensitive
  Searching for a full match

Found matching item: Pyramid-Fancy
Gallery item information:
  URL: "private:gallery/svdraw/dd2432"
  Fnm: "/usr/lib/libreoffice/share/gallery/dd2432"
  Path: gallery/svdraw/dd2432
  Title: "Pyramid-Fancy"
  Type: drawing

Figure 3: There is still a Gallery Item but it properties are wiped.

Gallery item information:
  URL: Property NOT Found
  Fnm: Unable to compute to do no URL Property
  Path: Unable to compute to do no URL Property
  Title: Property NOT Found
  Type: empty

Figure 4: VS Code Debugger shows expected results.

Figure 5: Debugger shows properties are lost.

I create a bug report tdf#151932 for this issue.