def this_week_day(base_date, weekday):
 day_of_week = base_date.weekday()
 if (day_of_week > weekday):
  return next_week_day(base_date, weekday)
 start_of_this_week = (base_date - timedelta(days=(day_of_week + 1)))
 day = (start_of_this_week + timedelta(days=1))
 while (day.weekday() != weekday):
  day = (day + timedelta(days=1))
 return day

def this_week_day ( base_date , weekday ) : day_of_week = base_date . weekday ( ) if ( day_of_week > weekday ) : return next_week_day ( base_date , weekday ) start_of_this_week = ( base_date - timedelta ( days = ( day_of_week + 1 ) ) ) day = ( start_of_this_week + timedelta ( days = 1 ) ) while ( day . weekday ( ) != weekday ) : day = ( day + timedelta ( days = 1 ) ) return day
return current day of the week 1 .