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