simple function to merge three parts into an uri

def uri_from_parts(parts):
    "simple function to merge three parts into an uri"
    uri = "%s://%s%s" % (parts[0], parts[1], parts[2])
    if parts[3]:
        extra = '?'+urlencode(parts[3])
        uri += extra
    return uri