@classmethod<EOL><INDENT>def cast_item(cls, key, value):<DEDENT>
schema_type = cls.schema.get(key)<EOL>if schema_type is None:<EOL><INDENT>if cls.strict:<EOL><INDENT>raise TypeError(f'<STR_LIT>')<EOL><DEDENT><DEDENT>elif not isinstance(value, schema_type):<EOL><INDENT>try:<EOL><INDENT>return schema_type(value)<EOL><DEDENT>except CastError:<EOL><INDENT>raise<EOL><DEDENT>except Exception as exc:<EOL><INDENT>raise CastError(value, schema_type) from exc<EOL><DEDENT><DEDENT>return value<EOL>
Cast schema item to the appropriate tag type.