code: @Override
    public Set<String> extract(List<String> messages) throws ExtractionException {
      boolean gotFetch = false;
      Set<String> result = null;
  
      // Find FETCH, throw error if none or more than one, or if we receive an error response.
      String fetchStr = null;
      for (int i = 0, messagesSize = messages.size(); i < messagesSize; i++) {
        String message = messages.get(i);
        if (null == message || message.isEmpty())
          continue;
  
        fetchStr = matchAndGetGroup1(FETCH_LABEL_PATT, message);
        if(fetchStr != null) {
          if (gotFetch) {
            throw new ExtractionException("STORE_LABELS RESPONSE: Got more than one FETCH " +
                "response " + message);
          }
          gotFetch = true;
          result = Sets.<String>newHashSet();
          result.addAll(Parsing.tokenize(fetchStr));
          result.remove("(");
          result.remove(")");
        } else {
          if(matchAndGetGroup1(OK_PATT, message) != null) {
            if (!gotFetch) {
              throw new ExtractionException("STORE_LABELS RESPONSE: no LABELS received." +
                  message);
            }
            // All Good.
          } else if (matchAndGetGroup1(BAD_PATT, message) != null || matchAndGetGroup1(NO_PATT,
              message) != null) {
            throw new ExtractionException("STORE_LABELS RESPONSE: " + message);
          }
        }
      }
      return result;
    }
docs: Parse the response, which includes label settings and command status.
  We expect only one FETCH response as we only set labels on one msg.
  
  http://code.google.com/apis/gmail/imap/#x-gm-labels
  C: a011 STORE_FLAGS 1 +X-GM-LABELS (foo)
  S: * 1 FETCH (X-GM-LABELS (\Inbox \Sent Important "Muy Importante" foo))
  S: a011 OK STORE_FLAGS (Success)