<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_valid_scalar(self, node: ValueNode) -> None: """Check whether this is a valid scalar. Any value literal may be a valid representation of a Scalar, depending on that scalar type. """

        # Report any error at the full type expected by the location.
        location_type = self.context.get_input_type()
        if not location_type:
            return

        type_ = get_named_type(location_type)

        if not is_scalar_type(type_):
            self.report_error(
                GraphQLError(
                    bad_value_message(
                        location_type,
                        print_ast(node),
                        enum_type_suggestion(type_, node),
                    ),
                    node,
                )
            )
            return

        # Scalars determine if a literal value is valid via `parse_literal()` which may
        # throw or return an invalid value to indicate failure.
        type_ = cast(GraphQLScalarType, type_)
        try:
            parse_result = type_.parse_literal(node)
            if is_invalid(parse_result):
                self.report_error(
                    GraphQLError(
                        bad_value_message(location_type, print_ast(node)), node
                    )
                )
        except Exception as error:
            # Ensure a reference to the original error is maintained.
            self.report_error(
                GraphQLError(
                    bad_value_message(location_type, print_ast(node), str(error)),
                    node,
                    original_error=error,
                )
            )