Implement search URL generation in a pythonic way