import socket
import pickle


def send_request(port, message):
    """Send a request to an IPCServer.

    Args:
        port (int): port to connect to
        message (any type)

    Returns:
        response (any type)
    """
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect(("localhost", port))
    pickle.dump(message, s.makefile("wb"))
    return pickle.load(s.makefile("rb"))