"""
A cmd lookalike handler.
"""


class CommandHandler():
    def uknnowm(self, session, cmd):
        session.push('Unknown command: {}\r\n'.format(cmd).encode())

    def handle(self, session, line):
        if not line.strip():
            return
        parts = line.split(b' ', 1)
        cmd = parts[0]
        try:
            line = parts[1].strip()
        except IndexError:
            line = ''
        meth = getattr(self, 'do_' + cmd.decode(), None)
        if callable(meth):
            meth(session, line)
        else:
            self.uknnowm(session, cmd)

8618eff43c429d9459094a4a6ef3935c0c215553
<mask token>

<mask token>


class CommandHandler:
    <mask token>
    <mask token>

<mask token>


class CommandHandler:

    def uknnowm(self, session, cmd):
        session.push('Unknown command: {}\r\n'.format(cmd).encode())
    <mask token>

<mask token>


class CommandHandler:

    def uknnowm(self, session, cmd):
        session.push('Unknown command: {}\r\n'.format(cmd).encode())

    def handle(self, session, line):
        if not line.strip():
            return
        parts = line.split(b' ', 1)
        cmd = parts[0]
        try:
            line = parts[1].strip()
        except IndexError:
            line = ''
        meth = getattr(self, 'do_' + cmd.decode(), None)
        if callable(meth):
            meth(session, line)
        else:
            self.uknnowm(session, cmd)

"""
A cmd lookalike handler.
"""


class CommandHandler():
    def uknnowm(self, session, cmd):
        session.push('Unknown command: {}\r\n'.format(cmd).encode())

    def handle(self, session, line):
        if not line.strip():
            return
        parts = line.split(b' ', 1)
        cmd = parts[0]
        try:
            line = parts[1].strip()
        except IndexError:
            line = ''
        meth = getattr(self, 'do_' + cmd.decode(), None)
        if callable(meth):
            meth(session, line)
        else:
            self.uknnowm(session, cmd)
