(msg, domain_object, utcnow)
return False
Checks whether or not we need to hold off on sending an outbound message
    due to any restrictions set on the domain, and delays processing of the
    message if necessary.

    Returns True if a delay was made, False if not.
Checks whether or not we need to hold off on sending an outbound message
    due to any restrictions set on the domain, and delays processing of the
    message if necessary.
Checks whether or not we need to hold off on sending an outbound message due to any restrictions set on the domain and delays processing of the message if necessary .
def handle_domain_specific_delays(msg, domain_object, utcnow):
    """
    Checks whether or not we need to hold off on sending an outbound message
    due to any restrictions set on the domain, and delays processing of the
    message if necessary.

    Returns True if a delay was made, False if not.
    """
    domain_now = ServerTime(utcnow).user_time(domain_object.get_default_timezone()).done()

    if len(domain_object.restricted_sms_times) > 0:
        if not time_within_windows(domain_now, domain_object.restricted_sms_times):
            delay_processing(msg, settings.SMS_QUEUE_DOMAIN_RESTRICTED_RETRY_INTERVAL)
            return True

    if msg.chat_user_id is None and len(domain_object.sms_conversation_times) > 0:
        if time_within_windows(domain_now, domain_object.sms_conversation_times):
            sms_conversation_length = domain_object.sms_conversation_length
            conversation_start_timestamp = utcnow - timedelta(minutes=sms_conversation_length)
            if SMS.inbound_entry_exists(
                msg.couch_recipient_doc_type,
                msg.couch_recipient,
                conversation_start_timestamp,
                to_timestamp=utcnow
            ):
                delay_processing(msg, 1)
                return True

    return False
def handle_domain_specific_delays ( msg , domain_object , utcnow ) : domain_now = ServerTime ( utcnow ) . user_time ( domain_object . get_default_timezone ( ) ) . done ( ) if len ( domain_object . restricted_sms_times ) > 0 : if not time_within_windows ( domain_now , domain_object . restricted_sms_times ) : delay_processing ( msg , settings . SMS_QUEUE_DOMAIN_RESTRICTED_RETRY_INTERVAL ) return True if msg . chat_user_id is None and len ( domain_object . sms_conversation_times ) > 0 : if time_within_windows ( domain_now , domain_object . sms_conversation_times ) : sms_conversation_length = domain_object . sms_conversation_length conversation_start_timestamp = utcnow - timedelta ( minutes = sms_conversation_length ) if SMS . inbound_entry_exists ( msg . couch_recipient_doc_type , msg . couch_recipient , conversation_start_timestamp , to_timestamp = utcnow ) : delay_processing ( msg , 1 ) return True return False