import json


def post_to_query_string(dico):

    """ Transform a dict to a query string
   
        >>> post_to_query_string({'foo': 'bar', 'where': {'foo': 'bar'}})
        ?foo=bar&where={"foo": "bar"}

        :params dico the dico to convert
    """

    querystring = "?"
    for key in dico:
        querystring += "%s=" % key
        if type(dico[key]) == dict:
            querystring += json.dumps(dico[key])
        else:
            querystring += str(dico[key])
        querystring += "&"
    return querystring.rstrip('&')