search function migration to python 3