def dict_to_qs(dct):
 itms = [('%s=%s' % (key, val)) for (key, val) in list(dct.items()) if (val is not None)]
 return '&'.join(itms)

def dict_to_qs ( dct ) : itms = [ ( '%s=%s' % ( key , val ) ) for ( key , val ) in list ( dct . items ( ) ) if ( val is not None ) ] return '&' . join ( itms )
takes a dictionary and uses it to create a query string .