changed the import for urlencode to work on python 2 and 3