def request_check(client, exception, *msg_parms, **kwargs):
    """Make blocking request to client and raise exception if reply is not ok.

    Parameters
    ----------
    client : DeviceClient instance
    exception: Exception class to raise
    *msg_parms : Message parameters sent to the Message.request() call
    **kwargs : Keyword arguments
        Forwards kwargs['timeout'] to client.blocking_request().
        Forwards kwargs['mid'] to Message.request().

    Returns
    -------
    reply, informs : as returned by client.blocking_request

    Raises
    ------
    *exception* passed as parameter is raised if reply.reply_ok() is False

    Notes
    -----
    A typical use-case for this function is to use functools.partial() to bind
    a particular client and exception. The resulting function can then be used
    instead of direct client.blocking_request() calls to automate error
    handling.

    """
    timeout = kwargs.get('timeout', None)
    req_msg = Message.request(*msg_parms)
    if timeout is not None:
        reply, informs = client.blocking_request(req_msg, timeout=timeout)
    else:
        reply, informs = client.blocking_request(req_msg)

    if not reply.reply_ok():
        raise exception('Unexpected failure reply "{2}"\n'
                        ' with device at {0}, request \n"{1}"'
                        .format(client.bind_address_string, req_msg, reply))
    return reply, informs
Make blocking request to client and raise exception if reply is not ok.

    Parameters
    ----------
    client : DeviceClient instance
    exception: Exception class to raise
    *msg_parms : Message parameters sent to the Message.request() call
    **kwargs : Keyword arguments
        Forwards kwargs['timeout'] to client.blocking_request().
        Forwards kwargs['mid'] to Message.request().

    Returns
    -------
    reply, informs : as returned by client.blocking_request

    Raises
    ------
    *exception* passed as parameter is raised if reply.reply_ok() is False

    Notes
    -----
    A typical use-case for this function is to use functools.partial() to bind
    a particular client and exception. The resulting function can then be used
    instead of direct client.blocking_request() calls to automate error
    handling.