Using functools.partial for cpl error codes selection