code: def receive(self, request, wait=True, timeout=None):
          
          start_time = time.time()
  
          # check if we have received a response
          while True:
              self._flush_message_buffer()
              status = request.response['status'].get_value() if \
                  request.response else None
              if status is not None and (wait and
                                         status != NtStatus.STATUS_PENDING):
                  break
              current_time = time.time() - start_time
              if timeout and (current_time > timeout):
                  error_msg = "Connection timeout of %d seconds exceeded while" \
                              " waiting for a response from the server" \
                              % timeout
                  raise smbprotocol.exceptions.SMBException(error_msg)
  
          response = request.response
          status = response['status'].get_value()
          if status not in [NtStatus.STATUS_SUCCESS, NtStatus.STATUS_PENDING]:
              raise smbprotocol.exceptions.SMBResponseException(response, status)
  
          # now we have a retrieval request for the response, we can delete
          # the request from the outstanding requests
          message_id = request.message['message_id'].get_value()
          del self.outstanding_requests[message_id]
  
          return response
docs: Polls the message buffer of the TCP connection and waits until a valid
          message is received based on the message_id passed in.
  
          :param request: The Request object to wait get the response for
          :param wait: Wait for the final response in the case of a
              STATUS_PENDING response, the pending response is returned in the
              case of wait=False
          :param timeout: Set a timeout used while waiting for a response from
              the server
          :return: SMB2HeaderResponse of the received message