def parse_qs(query):
    """
        parse a uri query string into a dict
    """
    pd = {}
    if '&' in query:
        for el in query.split('&'):
            nm, junk, vl = el.partition('=')
            pd.setdefault(nm, []).append(vl)
    return pd
