def apply_leniency(contact_phone_number):
    from corehq.apps.sms.util import strip_plus
    # Decimal preserves trailing zeroes, so it's ok 
    if isinstance(contact_phone_number, (int, long, Decimal)):
        contact_phone_number = str(contact_phone_number)
    if isinstance(contact_phone_number, basestring):
        chars = re.compile(r"[()\s\-.]+")
        contact_phone_number = chars.sub("", contact_phone_number)
        contact_phone_number = strip_plus(contact_phone_number)
    else:
        contact_phone_number = None
    return contact_phone_number
Standard deviation of observed values, weighted by measurement errors.
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/sms/mixin.py/apply_leniency--crossover with--dataset/ETHPy150Open cesium-ml/cesium/cesium/science_features/common_functions.py/weighted_std_dev