Added example using functools.singledispatch