def METHOD_NAME(text: str):
    """Look for url in text, check if URL is allowed and return the cleaned URL.
    By default, only the protocol ``javascript`` is denied.
    """
    if not text:
        return
    end_of_match = 0
    new_text = ""
    for match in re.finditer(HYPERLINK_TAG_WITH_URL_PATTERN, text):
        original_url = match.group(2)
        original_url.strip()
        url = parse_url(original_url)
        new_url = url.url
        if url.scheme in BLACKLISTED_URL_SCHEMES:
            warnings.warn(
                f"An invalid url was sent: {original_url} "
                f"-- Scheme: {url.scheme} is blacklisted"
            )
            new_url = "#invalid"
        new_text += match.group(1) + new_url + match.group(3)
        end_of_match = match.end()
    if end_of_match:
        new_text += text[end_of_match:]
    return new_text if new_text else text