def handle(verified_contact, text, msg=None):
    domain = Domain.get_by_name(verified_contact.domain)
    if not domain.commtrack_enabled:
        return False

    try:
        if toggles.STOCK_AND_RECEIPT_SMS_HANDLER.enabled(domain):
            # handle special stock parser for custom domain logic
            data = StockAndReceiptParser(domain, verified_contact).parse(text.lower())
        else:
            # default report parser
            data = StockReportParser(domain, verified_contact).parse(text.lower())
        if not data:
            return False
    except NotAUserClassError:
        return False
    except Exception, e: # todo: should we only trap SMSErrors?
        if settings.UNIT_TESTING or settings.DEBUG:
            raise
        send_sms_to_verified_number(verified_contact, 'problem with stock report: %s' % str(e))
        return True

    process(domain.name, data)
    send_confirmation(verified_contact, data)
    return True
top-level handler for incoming stock report messages
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/commtrack/sms.py/handle