(contact_phone_number)
return contact_phone_number
The documentation says that contact_phone_number should be
    in international format and consist of only digits. However,
    we can apply some leniency to avoid common mistakes.
    Returns None if an unsupported data type is passed in.
The documentation says that contact_phone_number should be
    in international format and consist of only digits. However,
    we can apply some leniency to avoid common mistakes.
    Returns None if an unsupported data type is passed in.
The documentation says that contact_phone_number should be in international format and consist of only digits . However we can apply some leniency to avoid common mistakes . Returns None if an unsupported data type is passed in .
def apply_leniency(contact_phone_number):
    """
    The documentation says that contact_phone_number should be
    in international format and consist of only digits. However,
    we can apply some leniency to avoid common mistakes.
    Returns None if an unsupported data type is passed in.
    """
    from corehq.apps.sms.util import strip_plus
    # Decimal preserves trailing zeroes, so it's ok
    if isinstance(contact_phone_number, (int, Decimal)):
        contact_phone_number = str(contact_phone_number)
    if isinstance(contact_phone_number, str):
        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
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 , Decimal ) ) : contact_phone_number = str ( contact_phone_number ) if isinstance ( contact_phone_number , str ) : 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