import logging
import requests


def check_internet(url='http://www.google.com/'):
    """
    Check an internet connection by requesting a provided URL. If no URL is provided,
    google.com is used.
    """
    
    logging.info("Checking internet connection (%s)", url)
    timeout=5
    try:
        _ = requests.get(url, timeout=timeout)
        logging.info("Internet connection (%s) available", url)
        return True
    except requests.ConnectionError:
        logging.warn("Internet connection (%s) unavailable", url)
    return False