'Send OP_INSERT, etc., optionally returning response as a dict.
Can raise ConnectionFailure or OperationFailure.
:Parameters:
- `request_id`: an int.
- `msg`: bytes, an OP_INSERT, OP_UPDATE, or OP_DELETE message,
perhaps with a getlasterror command appended.
- `max_doc_size`: size in bytes of the largest document in `msg`.
- `with_last_error`: True if a getlasterror command is appended.'

def legacy_write(self, request_id, msg, max_doc_size, with_last_error):

    if ((not with_last_error) and (not self.is_writable)):
        raise NotMasterError('not    master')
    self.send_message(msg, max_doc_size)
    if with_last_error:
        response = self.receive_message(1, request_id)
        return helpers._check_gle_response(response)
