def factory(cid, classes=CLASS_CACHE): if len(classes) == 0: check.factory(cid, classes) for name, obj in inspect.getmembers(sys.modules[__name__]): if inspect.isclass(obj): try: classes[obj.cid] = obj except AttributeError: pass if cid in classes: return classes[cid] else: return None