code: def process_doc(doc, *patterns):
      request = TokensRegexRequest()
      for pattern in patterns:
          request.pattern.append(pattern)
  
      request_doc = request.doc
      request_doc.text = doc.text
      num_tokens = 0
      for sentence in doc.sentences:
          add_sentence(request_doc.sentence, sentence, num_tokens)
          num_tokens = num_tokens + sum(
              len(token.words) for token in sentence.tokens
          )
  
      return send_tokensregex_request(request)
  
imports: import stanza
  from stanza.protobuf import TokensRegexRequest, TokensRegexResponse
  from stanza.server.java_protobuf_requests import send_request, add_sentence
label_desc: Use image node_id 2 for calling a global function with example usage: process_doc(doc) and returns: send_tokensregex_request