code: def get_variable_value(schema, definition_ast, input):
      """Given a variable definition, and any value of input, return a value which adheres to the variable definition,
      or throw an error."""
      type = type_from_ast(schema, definition_ast.type)
      variable = definition_ast.variable
  
      if not type or not is_input_type(type):
          raise GraphQLError(
              'Variable "${}" expected value of type "{}" which cannot be used as an input type.'.format(
                  variable.name.value,
                  print_ast(definition_ast.type),
              ),
              [definition_ast],
          )
  
      input_type = type
      errors = is_valid_value(input, input_type)
      if not errors:
          if input is None:
              default_value = definition_ast.default_value
              if default_value:
                  return value_from_ast(default_value, input_type)
  
          return coerce_value(input_type, input)
  
      if input is None:
          raise GraphQLError(
              'Variable "${}" of required type "{}" was not provided.'.format(
                  variable.name.value, print_ast(definition_ast.type)
              ),
              [definition_ast],
          )
  
      message = ("\n" + "\n".join(errors)) if errors else ""
      raise GraphQLError(
          'Variable "${}" got invalid value {}.{}'.format(
              variable.name.value,
              json.dumps(input, sort_keys=True),
              message,
          ),
          [definition_ast],
      )
  
file_path: wandb/wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py
imports: from collections.abc import Iterable
  import json
  from ..error import GraphQLError
  from ..language.printer import print_ast
  from ..type import GraphQLEnumType, GraphQLInputObjectType, GraphQLList, GraphQLNonNull, GraphQLScalarType, is_input_type
  from ..utils.is_valid_value import is_valid_value
  from ..utils.type_from_ast import type_from_ast
  from ..utils.value_from_ast import value_from_ast
label_desc: Use image node_id 3 for calling a global function with example usage: get_variable_value(schema, definition_ast, input) and returns: coerce_value, value_from_ast