Use functools.partial() instead of a lambda expression