def get_site_url(site):
    """Get a ``site`` URL

    :param str site: the site to get URL for
    :return: a valid site URL
    :raise ValueError: when site is empty, or isn't well formatted

    The ``site`` argument is checked: its scheme must be ``http`` or ``https``,
    or a :exc:`ValueError` is raised.

    If the ``site`` does not have a scheme, ``http`` is used. If it doesn't
    have a TLD, a :exc:`ValueError` is raised.
    """
    site = site.strip() if site else ''
    if not site:
        raise ValueError('What site do you want to check?')

    if not site.startswith(('http://', 'https://')):
        if '://' in site:
            protocol = site.split('://')[0] + '://'
            raise ValueError('Try it again without the %s' % protocol)

        site = 'http://' + site

    domain = site.split('/')[2].split(':')[0]
    if '.' not in domain:
        raise ValueError('I need a fully qualified domain name (with a dot).')
    if domain.endswith(('.local', '.example', '.test', '.invalid', '.localhost')):
        raise ValueError("I can't check LAN-local or invalid domains.")

    return site