code: def previous_friday(dt):
      
      if dt.weekday() == 5:
          return dt - timedelta(1)
      elif dt.weekday() == 6:
          return dt - timedelta(2)
      return dt
docs: If holiday falls on Saturday or Sunday, use previous Friday instead.