import socket


def check_server(ip='191.30.80.131', port=23, timeout=3):
    """
    # `check_server(ip, port, timeout)`
    
    Check if the server at `ip` on port `port` is responding.

    It waits for `timeout` seconds before returning `False`

    ## Arguments
    * `ip`: IP address of the server
    * `port`: Port number the connection should be attempted
    * `timeout`: Time in seconds that the function should wait before giving up
    ## Return
    * `True` if the server responded
    * `False`otherwise 
    """
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.settimeout(5)
    try:
        s.connect((ip,port))
        return True
    except:
        return False