Ok, the python functions are overrides for the DLL functions in both cases. The DLL functions check the return value from the Python function, if it is true it breaks out of the function in the DLL. So, in laymans terms, returning true will keep the Holy Cities from being created while returning false allows the DLL to continue through it's normal process.
To use this to restrict specific religions you simply need to force it to return true as needed to disallow it, false to allow it.
In your case you'd need two checks, the first to check for the tech (is this a tech that founds a restricted religion?) and the second to check the civ if it is a restricted religion. You will do all of this in CvGameUtils.py using the doHolyCityTech() functions since that is the one out of the two listed that has any useful data passed to it (player, tech, etc).
I can't write the whole thing out for you right now since I'm short on time but your basic code should flow something like this:
if technology is for restricted religion...
...if the civ that discovered it is the civ that can found it
......if this religion hasn't been founded yet (this is the tricky part)
.........return false (this means go ahead)
......else return true (religion already exists don't found it)
...else return true (wrong civ don't found it)
else return false (not restricted, proceed as normal no checks required)
The tricky part will be checking to see if the religion has already been founded, normally this is handled by simply giving it to the first to discover the tech but you won't be able to do that since you need the first that discovered the tech and can found the religion.
A more elgant, code-free solution would be to give specific civs or cultural groups (e.g. Oriental/European) a free invisible, useless technology at the start of the game that would be required to research the technology that founds the specific religion and move the religion founding tech onto their own dead-end technologies that do nothing except found the religion. The reason I say this is more elegant is because it allows the normal rules to work without adding any complexity to the code base while still achieving the desired result. It also makes it possible (and even easy) to have religions defined by ethnic groups much like art styles, giving the religion to the first civ in that group to discover the technology.
Assuming, of course, that I understood your request