def make_url(portal_url, *arg):
    """Makes a URL from the given portal url and path elements."""

    url = portal_url
    for path_element in arg:
        if path_element == "":
            continue
        while url.endswith("/"):
            url = url[:-1]
        while path_element.startswith("/"):
            path_element = path_element[1:]
        url = url+"/"+path_element

    return url