code: def _CheckType(value, check_type, name, allow_none=True):
    
    if value is None and allow_none:
      return
    if not isinstance(value, check_type):
      raise TypeError('%s type doesn\'t match %s.' % (name, check_type))
docs: Check that the type of an object is acceptable.
  
    Args:
      value: The object whose type is to be checked.
      check_type: The type that the object must be an instance of.
      name: Name of the object, to be placed in any error messages.
      allow_none: True if value can be None, false if not.
  
    Raises:
      TypeError: If value is not an acceptable type.