Is there an equivalent to urllib.urlencode for Python scripts?

I tried to import urllib and then use the above, but no luck.  Am I missing something obvious?

Thanks
Etienne