input: Write a python function to filter words based on a set of allowed words.
  assert filter_words(['apple', 'banana', 'cherry', 'date'], {'banana', 'date'}) == ['banana', 'date']
  assert filter_words(['dog', 'cat', 'mouse', 'elephant'], {'cat', 'mouse'}) == ['cat', 'mouse']
  assert filter_words(['red', 'blue', 'green', 'yellow'], {'blue', 'yellow'}) == ['blue', 'yellow']
output: def filter_words(words, allowed_words):
      return [word for word in words if word in allowed_words]