How to convert the type of function's arguments in Python at runtime?