An other option would be to use iterable unpacking to get `res`, this way only 2 lines have to be modified and the rest can remain untouched.