def url_fix(s, charset='utf-8'):
 if isinstance(s, unicode):
  s = s.encode(charset, 'replace')
 (scheme, netloc, path, qs, anchor) = _safe_urlsplit(s)
 path = _quote(path, '/%')
 qs = _quote_plus(qs, ':&%=')
 return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))

def url_fix ( s , charset = 'utf-8' ) : if isinstance ( s , unicode ) : s = s . encode ( charset , 'replace' ) ( scheme , netloc , path , qs , anchor ) = _safe_urlsplit ( s ) path = _quote ( path , '/%' ) qs = _quote_plus ( qs , ':&%=' ) return urlparse . urlunsplit ( ( scheme , netloc , path , qs , anchor ) )
function to fix any urls that have spaces in them urllib for some reason doesnt like spaces function found on internet .