trying to generalize toweekly to toperiod but doesnt work yet, in progress
generalized toweekly to toperiod with default kwarg week, works but no tests