input: Write a Python function to calculate the average fare for each passenger class from a given CSV file.
  assert calculate_average_fare('test_data.csv') == {1: 84.15, 2: 43.20, 3: 22.50}
  assert calculate_average_fare('sample_data.csv') == {1: 50.00, 2: 30.00, 3: 10.00}
  assert calculate_average_fare('passenger_data.csv') == {1: 100.00, 2: 75.00, 3: 50.00}
output: def calculate_average_fare(filename):
      import csv
      from collections import defaultdict
      
      fares = defaultdict(list)
      
      with open(filename, mode='r') as file:
          reader = csv.DictReader(file)
          for row in reader:
              pclass = int(row['Pclass'])
              fare = float(row['Fare'])
              fares[pclass].append(fare)
      
      average_fares = {pclass: sum(fares[pclass]) / len(fares[pclass]) for pclass in fares}
      return average_fares