def _cgi_to_dict(s): s = s.strip('&') if '=' in s: return dict([y.strip() for y in x.split('=', 1)] for x in s.split('&') if '=' in x) return dict()