docs: def previous_weekday(date):
      '''
      Returns the last weekday before date
  
      Args:
          date (datetime or datetime.date)
      Returns:
          (datetime or datetime.date)
      Raises:
          -
      '''
      weekday = date.weekday()
      if weekday == 0:
          n_days = 3
      elif weekday == 6:
          n_days = 2
      else:
          n_days = 1
      return date - datetime.timedelta(days=n_days)