code: private static void assertServerState(AdminClient adminClient,
                                            Collection<Integer> nodeIds,
                                            VoldemortState stateToCheck,
                                            boolean serverMustBeInThisState) {
          for(Integer nodeId: nodeIds) {
              String nodeName = adminClient.getAdminClientCluster().getNodeById(nodeId).briefToString();
              try {
                  Versioned<String> versioned = adminClient.metadataMgmtOps.getRemoteMetadata(nodeId,
                                                                                              MetadataStore.SERVER_STATE_KEY);
                  VoldemortState state = VoldemortState.valueOf(versioned.getValue());
                  if(state.equals(stateToCheck) != serverMustBeInThisState) {
                      throw new VoldemortException("Cannot execute admin operation: "
                                                   + nodeName + " is " + (serverMustBeInThisState ? "not in " : "in ")
                                                   + stateToCheck.name() + " state.");
                  }
              } catch (UnreachableStoreException e) {
                  System.err.println("Cannot verify the server state of " + nodeName + " because it is unreachable. Skipping.");
              }
          }
      }
docs: Checks if nodes are in a given {@link VoldemortState}. Can also be
  used to ensure that nodes are NOT in a given {@link VoldemortState}.
  
  Either way, throws an exception if any node isn't as expected.
  
  @param adminClient An instance of AdminClient points to given cluster
  @param nodeIds List of node ids to be checked
  @param stateToCheck state to be verified
  @param serverMustBeInThisState - if true, function will throw if any
  server is NOT in the stateToCheck
  - if false, function will throw if any
  server IS in the stateToCheck
  @throws VoldemortException if any node doesn't conform to the required state