def _CheckType(value, check_type, name, allow_none=True):
if value is None and allow_none:<EOL><INDENT>return<EOL><DEDENT>if not isinstance(value, check_type):<EOL><INDENT>raise TypeError('<STR_LIT>' % (name, check_type))<EOL><DEDENT>
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.