Add exhaustive_search function in python