def do_extensions(mname, item): try: _mod = __import__("saml2.extension.%s" % mname, globals(), locals(), mname) except ImportError: return None else: res = [] for _cname, ava in item.items(): cls = getattr(_mod, _cname) res.append(rec_factory(cls, **ava)) return res