def parse_query(cls, query):
        """return name=val&name2=val2 strings into {name: val} dict"""
        if not query: return {}

        d = {}
        # https://docs.python.org/2/library/urlparse.html
        for k, kv in urlparse.parse_qs(query, True, strict_parsing=True).items():
            #k = k.rstrip("[]") # strip out php type array designated variables
            if len(kv) > 1:
                d[k] = kv
            else:
                d[k] = kv[0]

        return d