code: def wait(self, timeout: Union[int, float] = None):
          
          # try to fetch the cached result.
          if self._has_returned:
              return self._result
  
          if timeout is not None:
              target = time.time() + timeout
              while time.time() < target:
                  self.child.join(timeout)
  
              if self.is_alive:
                  raise TimeoutError(
                      f"Timed-out while waiting for Process to return. -- {self!r}"
                  )
          else:
              self.child.join()
              if self.is_alive:
                  return None
          exitcode = self.exitcode
          if exitcode != 0:
              raise exceptions.ProcessWaitError(
                  f"Process finished with a non-zero exitcode ({exitcode}). -- {self!r}",
                  exitcode,
                  self,
              )
          try:
              self._result = serializer.loads(self._result_sock.recv())
          except zmq.error.Again:
              raise exceptions.ProcessWaitError(
                  "The Process died before sending its return value. "
                  "It probably crashed, got killed, or exited without warning.",
                  exitcode,
              )
  
          self._has_returned = True
          self._cleanup()
          return self._result
docs: Wait until this process finishes execution,
          then return the value returned by the ``target``.
  
          This method raises a a :py:exc:`.ProcessWaitError`,
          if the child Process exits with a non-zero exitcode,
          or if something goes wrong while communicating with the child.
  
          :param timeout:
              The timeout in seconds.
  
              If the value is ``None``, it will block until the zproc server replies.
  
              For all other values, it will wait for a reply,
              for that amount of time before returning with a :py:class:`TimeoutError`.
  
          :return:
              The value returned by the ``target`` function.