def remove_parameters(url):
    """Remove query parameters from a URL.

    This function looks for a '?' and removes it, together with everything that
    comes after. It also removes the trailing slash in order to keep things
    clean.
    """
    pos = url.find('?')
    if pos > -1:
        url = url[:pos]
    if url[-1] == '/':
        url = url[:-1]
    return url
