updated wordsearch.py

created a parameterized function wrapper for query