import socket


def check_for_open_port(ip_addr, port, timeout=None):
    """
    Creates a socket connection and tries to connect to the specified port.
    If connection succeeds returns True, else False.
    """
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    if timeout is not None:
        sock.settimeout(timeout)
    conn = sock.connect_ex((ip_addr, port))
    sock.close()
    return conn == 0