input: Write a python function to read a CSV file containing road data and compute the average speed for each road and direction combination.
  assert compute_average_speed('roads.csv') == {'Road1': {'N': 60.0, 'S': 55.0}, 'Road2': {'E': 45.0, 'W': 50.0}}
  assert compute_average_speed('roads_test.csv') == {'Highway1': {'N': 70.0, 'S': 65.0}, 'Highway2': {'E': 55.0, 'W': 60.0}}
output: import csv
  from collections import defaultdict
  
  def compute_average_speed(filename):
      road_data = defaultdict(lambda: defaultdict(list))
  
      with open(filename, newline='') as csvfile:
          reader = csv.DictReader(csvfile)
          for row in reader:
              road = row['road']
              direction = row['direction']
              speed = float(row['speed'])
              road_data[road][direction].append(speed)
  
      average_speeds = {}
      for road, directions in road_data.items():
          average_speeds[road] = {}
          for direction, speeds in directions.items():
              average_speeds[road][direction] = sum(speeds) / len(speeds)
  
      return average_speeds