def make_url(invocation, args=[], kwargs={}):
    if not invocation.endswith('/'):
        invocation += '/'
    if not invocation.startswith('/'):
        invocation = '/' + invocation

    url = invocation

    for arg in args:
        url += str(arg) + "/"

    if kwargs:
        url = url[:-1]
        url += "?" + urlencode(kwargs)
    
    return url
>>> make_url('some/path/program', ['arg1', 'arg2'], {'arg3': 4})
dataset/ETHPy150Open priestc/giotto/giotto/controllers/http.py/make_url