def _build_url(model: Model, *args, **kwargs) -> str:
    """
    Build the URL based on the base url from config, the resource url from the model and any provided *args and
    **kwargs. *args are appended to the base resource separated by /. **kwargs are added as url parameters
    with key=value
    """
    url_parts = []
    for part in args:
        url_parts.append('/')
        url_parts.append(str(part))

    if kwargs:
        url_parts.append('?')
        for k, v in kwargs.items():
            if v is not None and v is not False:
                url_parts += [k, '=', str(v), '&']

    if len(url_parts) != 0 and url_parts[-1] == '&':
        url_parts.pop()

    return ''.join([config.BASE_URL, model.RESOURCE_URL] + url_parts)

    Build the URL based on the base url from config, the resource url from the model and any provided *args and
    **kwargs. *args are appended to the base resource separated by /. **kwargs are added as url parameters
    with key=value
    
Solutions/MailRisk/Data Connectors/mailrisk.py