adding singledispatch sample from docs