code: def assert_no_pending(self, target_rule=None):
          '''
          Raises a :class:`PendingRequestsLeftException` error if server has target rule
          non-resolved.
  
          When target_rule argument is ommitted raises if server has any pending
          expectations.
  
          Useful in ``tearDown()`` test method to verify that test had correct expectations
  
          :type target_rule: Rule
          :param target_rule: will raise if this rule is left pending
  
          :raises: :class:`PendingRequestsLeftException`
          '''
          if target_rule:
              if target_rule in self._rules:
                  raise PendingRequestsLeftException()
          elif self._rules:
              raise PendingRequestsLeftException(f assert_no_pending(self, target_rule=None):
          '''
          Raises a :class:`PendingRequestsLeftException` error if server has target rule
          non-resolved.
  
          When target_rule argument is ommitted raises if server has any pending
          expectations.
  
          Useful in ``tearDown()`` test method to verify that test had correct expectations
  
          :type target_rule: Rule
          :param target_rule: will raise if this rule is left pending
  
          :raises: :class:`PendingRequestsLeftException`
          '''
          if target_rule:
              if target_rule in self._rules:
                  raise PendingRequestsLeftException()
          elif self._rules:
              raise PendingRequestsLeftException()
docs: Raises a :class:`PendingRequestsLeftException` error if server has target rule
          non-resolved.
  
          When target_rule argument is ommitted raises if server has any pending
          expectations.
  
          Useful in ``tearDown()`` test method to verify that test had correct expectations
  
          :type target_rule: Rule
          :param target_rule: will raise if this rule is left pending
  
          :raises: :class:`PendingRequestsLeftException`