def is_allowed(self, name_or_class, mask):  # pragma: no cover
        """Return True is a new connection is allowed"""
        if isclass(name_or_class):
            name = name_or_class.type
        else:
            name = name_or_class
        info = self.connections[name]
        limit = self.config[name + '_limit']
        if limit and info['total'] >= limit:
            msg = (
                "Sorry, there is too much DCC %s active. Please try again "
                "later.") % name.upper()
            self.bot.notice(mask, msg)
            return False
        if mask not in info['masks']:
            return True
        limit = self.config[name + '_user_limit']
        if limit and info['masks'][mask] >= limit:
            msg = (
                "Sorry, you have too many DCC %s active. Close the other "
                "connection(s) or wait a few seconds and try again."
            ) % name.upper()
            self.bot.notice(mask, msg)
            return False
        return True
dataset/ETHPy150Open gawel/irc3/irc3/dcc/manager.py/DCCManager.is_allowed/original