Switching python version to a shorter functional style