def get_next_dates_for_range(weekday, from_hour, to_hour):
    """
    Get datetime ranges for the next weekday

    Example:
        Give me the date ranges for the next Sunday from 1pm to 10pm
        It will return a tuple of datetimes.

    If the requested weekday is the same of today, it will return both the ranges for today
        and also for the next week.

    :rtype list[datetime.datetime]
    """
    import datetime
    from django.utils.timezone import now
    now_datetime = now()
    next_date = now_datetime + datetime.timedelta(days=abs(weekday -
        now_datetime.weekday()) % 7)
    ranges = [next_date.replace(hour=from_hour.hour, minute=from_hour.
        minute), next_date.replace(hour=to_hour.hour, minute=to_hour.minute)]
    if next_date.date() == now().date():
        next_week_date = next_date + datetime.timedelta(days=7)
        ranges.extend([next_week_date.replace(hour=from_hour.hour, minute=
            from_hour.minute), next_week_date.replace(hour=to_hour.hour,
            minute=to_hour.minute)])
    return ranges
