docs: def mock(self, obj=None, attr=None, **kwargs):
          '''
          Return a mock object.
          '''
          rval = Mock(**kwargs)
          if obj is not None and attr is not None:
              rval._object = obj
              rval._attr = attr
  
              if hasattr(obj, attr):
                  orig = getattr(obj, attr)
                  self._mocks.append((obj, attr, orig))
                  setattr(obj, attr, rval)
              else:
                  self._mocks.append((obj, attr))
                  setattr(obj, attr, rval)
          return rval