input: Write a python function to filter words based on a given pattern using the fnmatch library.
  assert filter_words(["cat", "dog", "camel", "car"], "ca*") == ["cat", "camel", "car"]
  assert filter_words(["apple", "banana", "apricot", "blueberry"], "ap*") == ["apple", "apricot"]
  assert filter_words(["house", "home", "hover", "heat"], "ho*") == ["house", "home", "hover"]
output: def filter_words(words, pattern):
      import fnmatch
      return [word for word in words if fnmatch.fnmatch(word, pattern)]