def assert_called_once(_mock_self):
    """assert that the mock was called only once.
        """
    self = _mock_self
    if not self.call_count == 1:
        msg = "Expected '%s' to have been called once. Called %s times.%s" % (
            self._mock_name or 'mock', self.call_count, self._calls_repr())
        raise AssertionError(msg)
