import socket


def is_connected(hostname="1.1.1.1"):
    """Validates internet connection.

    Parameters
    ----------
    hostname: str
        hostname to test reachability against.

    Returns
    -------
    bool
        True if reachable (Internet connection is ON), False otherwise.
    """
    try:
        # assert existence of a listening DNS
        host = socket.gethostbyname(hostname)
        # assert host is reachable
        s = socket.create_connection((host, 80), 2)
        s.close()
        return True
    except:
        pass
    return False