parameters: (arg, msg, is_argument=True)
return_statement: return arg
docstring: Check that the argument is a type, and return it (internal helper).
  
      As a special case, accept None 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).
docstring_summary: Check that the argument is a type, and return it (internal helper).
docstring_tokens: Check that the argument is a type and return it ( internal helper ) .
function: def _type_check(arg, msg, is_argument=True):
      """Check that the argument is a type, and return it (internal helper).
  
      As a special case, accept None 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).
      """
      invalid_generic_forms = (Generic, _Protocol)
      if is_argument:
          invalid_generic_forms = invalid_generic_forms + (ClassVar, )
  
      if arg is None:
          return type(None)
      if isinstance(arg, str):
          return ForwardRef(arg)
      if (isinstance(arg, _GenericAlias) and
              arg.__origin__ in invalid_generic_forms):
          raise TypeError(f"{arg} is not valid as type argument")
      if (isinstance(arg, _SpecialForm) and arg not in (Any, NoReturn) or
              arg in (Generic, _Protocol)):
          raise TypeError(f"Plain {arg} is not valid as type argument")
      if isinstance(arg, (type, TypeVar, ForwardRef)):
          return arg
      if not callable(arg):
          raise TypeError(f"{msg} Got {arg!r:.100}.")
      return arg
function_tokens: def _type_check ( arg , msg , is_argument = True ) : invalid_generic_forms = ( Generic , _Protocol ) if is_argument : invalid_generic_forms = invalid_generic_forms + ( ClassVar , ) if arg is None : return type ( None ) if isinstance ( arg , str ) : return ForwardRef ( arg ) if ( isinstance ( arg , _GenericAlias ) and arg . __origin__ in invalid_generic_forms ) : raise TypeError ( f"{arg} is not valid as type argument" ) if ( isinstance ( arg , _SpecialForm ) and arg not in ( Any , NoReturn ) or arg in ( Generic , _Protocol ) ) : raise TypeError ( f"Plain {arg} is not valid as type argument" ) if isinstance ( arg , ( type , TypeVar , ForwardRef ) ) : return arg if not callable ( arg ) : raise TypeError ( f"{msg} Got {arg!r:.100}." ) return arg