code: def _apply_middleware_to_plain_text(
      handle_text, upstream, env, start_resp
  ):
      env["HTTP_ACCEPT_ENCODING"] = "identity"
      start_resp_args = []
  
      def wrapped_start_resp(status, headers, exc_info):
          start_resp_args.extend([status, headers, exc_info])
  
      upstream_resp = upstream(env, wrapped_start_resp)
      middleware_resp, content_len = handle_text(upstream_resp)
      start_resp(
          *_apply_content_len_to_resp(content_len, start_resp_args)
      )
      return middleware_resp
  
imports: import logging
  import os
  import socket
  import time
  import warnings
  from guild import util
label_desc: Use image node_id 27 for calling a global function with example usage: _apply_middleware_to_plain_text(handle_text, upstream, env, start_resp) and returns: middleware_resp