def process_url(url, keep_params=('CONTENT_ITEM_ID=',)):
    parsed = urlparse.urlsplit(url)
filtered_query = '&'.join(qry_item for qry_item in parsed.query.split('&') if
    qry_item.startswith(keep_params))
Slicing URL with Python