import socket


def is_open_port(port):
    """
    Check if a port is open (listening) or not on localhost.

    It returns true if the port is actually listening, false
    otherwise.

    :param port: The port to check.
    """
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    result = sock.connect_ex(('127.0.0.1',port))
    return result == 0