(cls, recipient, try_usercase=True, domain_for_toggles=None)
return None
If recipient has a two-way number, returns it as a PhoneNumber entry.
        If recipient does not have a two-way number but has a phone number configured,
        returns the one-way phone number as a string.

        If try_usercase is True and recipient is a CommCareUser who doesn't have a
        two-way or one-way phone number, then it will try to get the two-way or
        one-way number from the user's user case if one exists.
If recipient has a two-way number, returns it as a PhoneNumber entry.
        If recipient does not have a two-way number but has a phone number configured,
        returns the one-way phone number as a string.
If recipient has a two - way number returns it as a PhoneNumber entry . If recipient does not have a two - way number but has a phone number configured returns the one - way phone number as a string .
def get_two_way_entry_or_phone_number(cls, recipient, try_usercase=True, domain_for_toggles=None):
        """
        If recipient has a two-way number, returns it as a PhoneNumber entry.
        If recipient does not have a two-way number but has a phone number configured,
        returns the one-way phone number as a string.

        If try_usercase is True and recipient is a CommCareUser who doesn't have a
        two-way or one-way phone number, then it will try to get the two-way or
        one-way number from the user's user case if one exists.
        """
        if settings.USE_PHONE_ENTRIES:
            phone_entry = get_two_way_number_for_recipient(recipient)
            if phone_entry:
                return phone_entry

        phone_number = get_one_way_number_for_recipient(recipient)

        if toggles.INBOUND_SMS_LENIENCY.enabled(domain_for_toggles) and \
                toggles.ONE_PHONE_NUMBER_MULTIPLE_CONTACTS.enabled(domain_for_toggles):
            phone_entry = PhoneNumber.get_phone_number_for_owner(recipient.get_id, phone_number)
            if phone_entry:
                return phone_entry

        # Avoid processing phone numbers that are obviously fake (len <= 3) to
        # save on processing time
        if phone_number and len(phone_number) > 3:
            return phone_number

        if try_usercase and isinstance(recipient, CommCareUser) and recipient.memoized_usercase:
            return cls.get_two_way_entry_or_phone_number(recipient.memoized_usercase,
                                                         domain_for_toggles=domain_for_toggles)

        return None
def get_two_way_entry_or_phone_number ( cls , recipient , try_usercase = True , domain_for_toggles = None ) : if settings . USE_PHONE_ENTRIES : phone_entry = get_two_way_number_for_recipient ( recipient ) if phone_entry : return phone_entry phone_number = get_one_way_number_for_recipient ( recipient ) if toggles . INBOUND_SMS_LENIENCY . enabled ( domain_for_toggles ) and toggles . ONE_PHONE_NUMBER_MULTIPLE_CONTACTS . enabled ( domain_for_toggles ) : phone_entry = PhoneNumber . get_phone_number_for_owner ( recipient . get_id , phone_number ) if phone_entry : return phone_entry # Avoid processing phone numbers that are obviously fake (len <= 3) to # save on processing time if phone_number and len ( phone_number ) > 3 : return phone_number if try_usercase and isinstance ( recipient , CommCareUser ) and recipient . memoized_usercase : return cls . get_two_way_entry_or_phone_number ( recipient . memoized_usercase , domain_for_toggles = domain_for_toggles ) return None