def _sanitize_url_components(comp_list, field):
 if (len(comp_list) == 0):
  return ''
 elif comp_list[0].startswith('{0}='.format(field)):
  ret = '{0}=XXXXXXXXXX&'.format(field)
  comp_list.remove(comp_list[0])
  return (ret + _sanitize_url_components(comp_list, field))
 else:
  ret = '{0}&'.format(comp_list[0])
  comp_list.remove(comp_list[0])
  return (ret + _sanitize_url_components(comp_list, field))

def _sanitize_url_components ( comp_list , field ) : if ( len ( comp_list ) == 0 ) : return '' elif comp_list [ 0 ] . startswith ( '{0}=' . format ( field ) ) : ret = '{0}=XXXXXXXXXX&' . format ( field ) comp_list . remove ( comp_list [ 0 ] ) return ( ret + _sanitize_url_components ( comp_list , field ) ) else : ret = '{0}&' . format ( comp_list [ 0 ] ) comp_list . remove ( comp_list [ 0 ] ) return ( ret + _sanitize_url_components ( comp_list , field ) )
recursive function to sanitize each component of the url .