'Error Conditions'

def lineReceived(self, line):

    uline = line.upper()
    find = (lambda s: (uline.find(s) != (-1)))
    if TIMEOUT_RESPONSE:
        return
    if DROP_CONNECTION:
        self.disconnect()
        return
    elif find('CAPA'):
        if INVALID_CAPABILITY_RESPONSE:
            self.sendLine(INVALID_RESPONSE)
        else:
            self.sendCapabilities()
    elif (find('STLS') and SSL_SUPPORT):
        self.startTLS()
    elif find('USER'):
        if INVALID_LOGIN_RESPONSE:
            self.sendLine(INVALID_RESPONSE)
            return
        resp = None
        try:
            self.tmpUser = line.split('    ')[1]
            resp = VALID_RESPONSE
        except:
            resp = AUTH_DECLINED
        self.sendLine(resp)
    elif find('PASS'):
        resp = None
        try:
            pwd = line.split('    ')[1]
            if ((self.tmpUser is None) or (pwd is None)):
                resp = AUTH_DECLINED
            elif ((self.tmpUser == USER) and (pwd == PASS)):
                resp = AUTH_ACCEPTED
                self.loggedIn = True
            else:
                resp = AUTH_DECLINED
        except:
            resp = AUTH_DECLINED
        self.sendLine(resp)
    elif find('QUIT'):
        self.loggedIn = False
        self.sendLine(LOGOUT_COMPLETE)
        self.disconnect()
    elif INVALID_SERVER_RESPONSE:
        self.sendLine(INVALID_RESPONSE)
    elif (not self.loggedIn):
        self.sendLine(NOT_LOGGED_IN)
    elif find('NOOP'):
        self.sendLine(VALID_RESPONSE)
    elif find('STAT'):
        if TIMEOUT_DEFERRED:
            return
        self.sendLine(STAT)
    elif find('LIST'):
        if TIMEOUT_DEFERRED:
            return
        self.sendLine(LIST)
    elif find('UIDL'):
        if TIMEOUT_DEFERRED:
            return
        elif (not UIDL_SUPPORT):
            self.sendLine(INVALID_RESPONSE)
            return
        self.sendLine(UIDL)
