def _validate_value(key, value, expected_type):
if not isinstance(value, expected_type):<EOL><INDENT>raise TypeError("<STR_LIT>".format(<EOL>key, expected_type, type(value)))<EOL><DEDENT>
function to check expected type and raise
    error if type is not correct