class Listener:
    def __init__(self, handler):
        self.handler = handler

    def handle(self, connection, message):
        self.handler(connection, message=message)


class CommandListener(Listener):
    def __init__(self, command, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.command = command

    def handle(self, connection, message):
        if message.command == self.command:
            super().handle(connection, message)

# class RegexListener(Listener):
#     def __init__(self, regex, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         self.regex = regex

@@ -462,16 +462,817 @@
 ssage)%0A%0A
+%0Aclass WhitelistListener(Listener):%0A    %22%22%22Invokes the handler for a whitelist of commands.%22%22%22%0A    def __init__(self, whitelist, *args, **kwargs):%0A        super().__init__(*args, **kwargs)%0A        self.whitelist = %5Bcommand.value for command in whitelist%5D%0A%0A    def handle(self, connection, message):%0A        if message.command in self.whitelist:%0A            super().handle(connection, message)%0A%0A%0Aclass BlacklistListener(Listener):%0A    %22%22%22Invokes the handler for all but a blacklist of commands.%22%22%22%0A    def __init__(self, blacklist, *args, **kwargs):%0A        super().__init__(*args, **kwargs)%0A        self.blacklist = %5Bcommand.value for command in blacklist%5D%0A%0A    def handle(self, connection, message):%0A        if message.command not in self.blacklist:%0A            super().handle(connection, message)%0A%0A%0A
 # class 

Add WhitelistListener and BlacklistListener