Handling of Python type function for custom types.