Charging battery animation over time
I took it to 6 to make it a little more readable:

def _animate_display(self, display):
    self._timer += 1 / bge.logic.getAverageFrameRate()
    symbolic_level = self.battery.get_symbolic_level()
    if self._timer &gt;= 5.0:
        self._timer = symbolic_level / 25
    else:
        utils.change_texture(display, 'DisplayMat', 'icons/battery_{}.png'.format(next((x,y) for x,y in zip(xrange(100, -1, -25), xrange(4, -1, -1)) if symbolic_level &lt;= x and self._timer &gt;= y)))