<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _update_battery_status(self, message=None, status=None):
 """ Uses the provided message to update the battery state. :param message: message to use to update :type message: :py:class:`~alarmdecoder.messages.Message` :param status: battery status, overrides message bits :type status: bool :returns: boolean indicating the new status """

        battery_status = status
        if isinstance(message, Message):
            battery_status = message.battery_low

        if battery_status is None:
            return

        last_status, last_update = self._battery_status
        if battery_status == last_status:
            self._battery_status = (last_status, time.time())
        else:
            if battery_status is True or time.time() > last_update + self._battery_timeout:
                self._battery_status = (battery_status, time.time())
                self.on_low_battery(status=battery_status)

        return self._battery_status[0]