and return type(None) instead. Also wrap strings into ForwardRef instances. Consider several corner cases, for example plain special forms like Union are not valid, while Union[int, str] is OK, etc. The msg argument is a human-readable error message, e.g.:: "Union[arg, ...]: arg should be a type." We append the repr() of the actual value (truncated to 100 chars). )