Get master page shapes handle in macro

I have been trying to create a libreoffice impress presentation by making a macro which reads ASCII files and writes them onto the slides. This works, and now I want to add formatting by using premade master slides, using the TextShape’s from the master slide.

I believe can get the master pages using:

mymasterpage=document.getMasterPages().getByName(nameofmasterpage)

but how can i get the shapes within, eg. a TitleTextShape and add them to a page?

EDIT:
I found out one can link a master page to a drawpage using

mypage.setMasterPage(mymasterpage)