def generate_url(url, *args, **kwargs):
    """Generate an url with input arguments.

    *args -> path parameter.
    *kwargs -> query parameter.
    """
    url = url.rstrip('/')
    if args:
        url = '/'.join([url, *args])
    if kwargs:
        for k, v in kwargs.items():
            if k == list(kwargs.keys())[0]:
                url += '?{}={}'.format(k, v)
                continue
            url += '&{}={}'.format(k, v)
    return url
