def get_institution_url(base_url):
    """
    Clean up a given base URL.

    :param base_url: The base URL of the API.
    :type base_url: str
    :rtype: str
    """
    base_url = base_url.rstrip('/')
    index = base_url.find('/api/v1')

    if index != -1:
        return base_url[0:index]

    return base_url
Clean up a given base URL.

    :param base_url: The base URL of the API.
    :type base_url: str
    :rtype: str