def METHOD_NAME(obj, sock):
    """Send a Python object over a socket. Object is pickle-encoded as the
    payload and sent preceded by a 4-byte header which indicates the number of
    bytes of the payload.
    Parameters
    ----------
    sock : socket
    obj : pickle-able Python object
        Object to send
    """
    # Turn object into a string
    payload = pickle.dumps(obj)
    # Create a header that says how large the payload is
    header = struct.pack('!i', len(payload))
    # Send header
    sock.sendall(header)
    # Send payload
    sock.sendall(payload)