code: def read_nonblocking(self, size, timeout):
      buf = self._buf
      if self._read_reached_eof:
          # We have already finished reading. Use up any buffered data,
          # then raise EOF
          if buf:
              self._buf = buf[size:]
              return buf[:size]
          else:
              self.flag_eof = True
              raise EOF("End Of File (EOF).")
  
      if timeout == -1:
          timeout = self.timeout
      elif timeout is None:
          timeout = 1e6
  
      t0 = time.time()
      while (time.time() - t0) < timeout and size and len(buf) < size:
          try:
              incoming = self._read_queue.get_nowait()
          except Empty:
              break
          else:
              if incoming is None:
                  self._read_reached_eof = True
                  break
  
              buf += self._decoder.decode(incoming, final=False)
  
      r, self._buf = buf[:size], buf[size:]
  
      self._log(r, "read")
      return r
  
imports: import os
  import threading
  import subprocess
  import sys
  import time
  import signal
  import shlex
  from .spawnbase import SpawnBase, PY3
  from .exceptions import EOF
  from .utils import string_types
label_desc: Use image node_id 2 for calling the PopenSpawn obj's underlying member method code with example usage: obj.read_nonblocking(size, timeout) and returns: r, buf