def relative_days(current_wday, wday, dir):
 if (current_wday == wday):
  return (7 * dir)
 if (dir == 1):
  return (((wday + 7) - current_wday) % 7)
 else:
  return ((((current_wday + 7) - wday) % 7) * (-1))

def relative_days ( current_wday , wday , dir ) : if ( current_wday == wday ) : return ( 7 * dir ) if ( dir == 1 ) : return ( ( ( wday + 7 ) - current_wday ) % 7 ) else : return ( ( ( ( current_wday + 7 ) - wday ) % 7 ) * ( - 1 ) )
returns the number of days to the "next" or "last" of a certain weekday .