Replace lambda with functools.