Get Enable Self Registration from Python Script

On a website, it is possible to get the value of the variable that stores if self-registration is enabled through the code

from plone.registry.interfaces import IRegistry
from Products.CMFPlone.interfaces.controlpanel import ISecuritySchema
getUtility(IRegistry).forInterface(ISecuritySchema, prefix='plone').enable_self_reg

There are many sites on a server and I would like to create a python script (on server/manage_main) to get which sites have auto-registration enabled but I can't import the dependencies into the script:

Module AccessControl.ZopeGuards, line 416, in guarded_import
Unauthorized: import of 'plone.registry.interfaces' is unauthorized

Is there any way to get this information? for example, using getToolByName(site, "portal_something").property_or_method

Thanks

Sounds strange that it can not be read.
Could something like this work:

portal_state.portal().portal_registry['Products.CMFPlone.interfaces.controlpanel.ISecuritySchema.plone']

Here's my script python so far, but it still doesn't work.

#from plone.registry.interfaces import IRegistry
#from Products.CMFPlone.interfaces.controlpanel import ISecuritySchema
#from zope.component import getUtility
for itemTuple0 in context.items():
    (item0, itemType0) = itemTuple0
    if str(itemType0).startswith('<PloneSite at '):
        site = getattr(context, item0)
        print "Plone site <b>%s</b>" % (item0)
        # here i would like to get if self-registration is enabled
        # i tried to insert Espen tip here but it does not work
        site.portal_registry['Products.CMFPlone.interfaces.controlpanel.ISecuritySchema.plone']
return printed

You can use the plone.api: plone.api.portal — Plone Documentation v5.2

from plone import api
api.portal.get_registry_record('plone.enable_self_reg')

If you are calling this script outside a Plone Site you may need to set the site first like:

from zope.component.hooks import setSite
setSite(site)

Yes, I'm calling this script outside a Plone Site. I tried to import from zope.component.hooks import setSite but I still get Unauthorized error but your code give me an idea that worked:

from Products.CMFCore.utils import getToolByName

for itemTuple0 in context.items():
    (item0, itemType0) = itemTuple0
    if str(itemType0).startswith('<PloneSite at '):
        site = getattr(context, item0)
        pr = getToolByName(site, "portal_registry")
        enable_self_reg = pr.get('plone.enable_self_reg')

Thank you all