'Check if port is open on localhost'

def is_running(self, port_str):

    port = int(port_str)
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    res = s.connect_ex((u'127.0.0.1', port))
    s.close()
    return (res == 0)
