def createConnection(cls, conInfo): conType = conInfo.type params = misc.namedtuple2dict(conInfo.params) for param in params.keys(): if params[param] is None: del params[param] try: ctor = cls._registeredConnectionTypes[conType] except KeyError: raise UnknownConnectionTypeError(conType) return ctor(**params)