from urllib.parse import urlparse


def deluge_is_url( torrent_url ):
    """
    Checks whether an URL is valid, following `this prescription <https://stackoverflow.com/questions/7160737/python-how-to-validate-a-url-in-python-malformed-or-not>`_.

    :param str torrent_url: candidate URL.
    
    :returns: ``True`` if it is a valid URL, ``False`` otherwise.
    :rtype: bool
    """
    try:
        result = urlparse( torrent_url )
        return all([result.scheme, result.netloc, result.path])
    except Exception as e: return False