docs: function ensureClient(client) {
    var err;
  
    if(!client) {
      // Likely close() was called and now another step is happening
      // when it shouldn't. Create and log an error, so we get a stack
      // and can see why it happened.
      err = new Error('expected this.client to exist');
      log.error(err);
    }
  
    // If we're in an unexpected state for syncing (i.e., not a sync step), log that
    switch(client.state) {
      case ServerStates.CREATED:
      case ServerStates.CLOSED:
      case ServerStates.CLOSING:
      case ServerStates.CONNECTING:
      case ServerStates.ERROR:
        log.warn({client: client}, 'Unexpected client state for sync protocol handling: %s', client.state);
        break;
    }
  
    return client;
  }