(start, time)
return end
Gets an expiration time for an alert.
    Works by adding on a certain time and wrapping around after business hours
    so that alerts that are started near the end of the day don't expire.

    Args:
        start (Datetime): A datetime object indicating when an alert was started.
        time (Timedelta): A timedelta representing the amount of time the alert
            should live for.
    Returns:
        Datetime: The expiry time for an alert.
Gets an expiration time for an alert.
    Works by adding on a certain time and wrapping around after business hours
    so that alerts that are started near the end of the day don't expire.
Gets an expiration time for an alert . Works by adding on a certain time and wrapping around after business hours so that alerts that are started near the end of the day don t expire .
def get_expiration_time(start, time):
    '''
    Gets an expiration time for an alert.
    Works by adding on a certain time and wrapping around after business hours
    so that alerts that are started near the end of the day don't expire.

    Args:
        start (Datetime): A datetime object indicating when an alert was started.
        time (Timedelta): A timedelta representing the amount of time the alert
            should live for.
    Returns:
        Datetime: The expiry time for an alert.
    '''
    if start.tzinfo is None:
        start = start.replace(tzinfo=pytz.utc)
    end = start + time
    if not during_business_hours(end):
        end_of_day = datetime(year=start.year,
                              month=start.month,
                              day=start.day,
                              hour=CLOSING_HOUR,
                              tzinfo=LOCAL_TZ)
        delta = end - end_of_day
        next_day = end_of_day + timedelta(hours=(OPENING_HOUR - CLOSING_HOUR) % 24)
        # This may land on a weekend, so march to the next weekday
        while not during_business_hours(next_day):
            next_day += timedelta(days=1)
        end = next_day + delta
    return end
def get_expiration_time ( start , time ) : if start . tzinfo is None : start = start . replace ( tzinfo = pytz . utc ) end = start + time if not during_business_hours ( end ) : end_of_day = datetime ( year = start . year , month = start . month , day = start . day , hour = CLOSING_HOUR , tzinfo = LOCAL_TZ ) delta = end - end_of_day next_day = end_of_day + timedelta ( hours = ( OPENING_HOUR - CLOSING_HOUR ) % 24 ) # This may land on a weekend, so march to the next weekday while not during_business_hours ( next_day ) : next_day += timedelta ( days = 1 ) end = next_day + delta return end