pythonized the search routine