Cleans the url for protocol prefix and trailing slash and replaces special characters
        with the given replacement.

        :param url: The url of the request.
        :param replacement: A string that is used to replace special characters.

def clean_url(url, replacement='_'):
        """
        Cleans the url for protocol prefix and trailing slash and replaces special characters
        with the given replacement.

        :param url: The url of the request.
        :param replacement: A string that is used to replace special characters.
        """
        cleaned = re.sub(r'/$', '', re.sub(r'https?://', '', url))
        for character in '/ _ ? & : ; %'.split():
            cleaned = cleaned.replace(character, replacement)
        return cleaned