def replace_url_query_values(url, replace_vals):
    """Replace querystring values in a url string.

    >>> url = 'http://helloworld.com/some/path?test=5'
    >>> replace_vals = {'test': 10}
    >>> replace_url_query_values(url=url, replace_vals=replace_vals)
    'http://helloworld.com/some/path?test=10'
    """
    if '?' not in url:
        return url

    parsed_url = urlparse(url)
    query = dict(parse_qsl(parsed_url.query))
    query.update(replace_vals)
    return '{0}?{1}'.format(url.split('?')[0], urlencode(query))