If you want to call another function based on the type of the current function’s argument, use functools.singledispatch.
The code above compares the code without singledispatch and the code with singledispatch.
With singledispatch, you don’t need to use an if-else statement to call an appropriate function. Singledispatch will choose the right function based on the type of current function’s first argument.