input: Write a python function to count word frequencies in a file.
  assert word_frequency('test1.txt') == {'hello': 2, 'world': 1}
  assert word_frequency('test2.txt') == {'python': 3, 'is': 2, 'awesome': 1}
  assert word_frequency('test3.txt') == {'openai': 1, 'gpt': 2, 'language': 1, 'model': 1}
output: def word_frequency(filename):
      from collections import defaultdict
      frequencies = defaultdict(int)
      
      with open(filename, 'r') as file:
          for line in file:
              words = line.split()
              for word in words:
                  frequencies[word.lower()] += 1
  
      return dict(frequencies)