def last_call(self, method=None):
        """Return the last call."""
        if not self.calls:
            return None
        elif method is None:
            return self.calls[-1]
        else:
            try:
                return next(call for call in reversed(self.calls)
                            if call[0] == method)
            except StopIteration:
                return None
dataset/ETHPy150Open home-assistant/home-assistant/tests/common.py/MockToggleDevice.last_call/original