code: def _timesheet_url(url_name, pk, date=None):
      
      url = reverse(url_name, args=(pk,))
      if date:
          params = {'month': date.month, 'year': date.year}
          return '?'.join((url, urlencode(params)))
      return url
docs: Utility to create a time sheet URL with optional date parameters.