code: def get_var(
      environ_cp,
      var_name,
      query_item,
      enabled_by_default,
      question=None,
      yes_reply=None,
      no_reply=None,
  ):
      """Get boolean input from user.
  
      If var_name is not set in env, ask user to enable query_item or not. If the
      response is empty, use the default.
  
      Args:
        environ_cp: copy of the os.environ.
        var_name: string for name of environment variable, e.g. "TF_NEED_CUDA".
        query_item: string for feature related to the variable, e.g. "CUDA for
          Nvidia GPUs".
        enabled_by_default: boolean for default behavior.
        question: optional string for how to ask for user input.
        yes_reply: optional string for reply when feature is enabled.
        no_reply: optional string for reply when feature is disabled.
  
      Returns:
        boolean value of the variable.
  
      Raises:
        UserInputError: if an environment variable is set, but it cannot be
          interpreted as a boolean indicator, assume that the user has made a
          scripting error, and will continue to provide invalid input.
          Raise the error to avoid infinitely looping.
      """
      if not question:
          question = (
              "Do you wish to build TensorFlow with {} support?".format(
                  query_item
              )
          )
      if not yes_reply:
          yes_reply = (
              "{} support will be enabled for TensorFlow.".format(
                  query_item
              )
          )
      if not no_reply:
          no_reply = "No {}".format(yes_reply)
  
      yes_reply += "\n"
      no_reply += "\n"
  
      if enabled_by_default:
          question += " [Y/n]: "
      else:
          question += " [y/N]: "
  
      var = environ_cp.get(var_name)
      if var is not None:
          var_content = var.strip().lower()
          true_strings = ("1", "t", "true", "y", "yes")
          false_strings = ("0", "f", "false", "n", "no")
          if var_content in true_strings:
              var = True
          elif var_content in false_strings:
              var = False
          else:
              raise UserInputError(
                  "Environment variable %s must be set as a boolean indicator.\n"
                  "The following are accepted as TRUE : %s.\n"
                  "The following are accepted as FALSE: %s.\n"
                  "Current value is %s."
                  % (
                      var_name,
                      ", ".join(true_strings),
                      ", ".join(false_strings),
                      var,
                  )
              )
  
      while var is None:
          user_input_origin = get_input(question)
          user_input = user_input_origin.strip().lower()
          if user_input == "y":
              print(yes_reply)
              var = True
          elif user_input == "n":
              print(no_reply)
              var = False
          elif not user_input:
              if enabled_by_default:
                  print(yes_reply)
                  var = True
              else:
                  print(no_reply)
                  var = False
          else:
              print("Invalid selection: {}".format(user_input_origin))
      return var
  
imports: import argparse
  import errno
  import glob
  import json
  import os
  import platform
  import re
  import subprocess
  import sys
label_desc: Use image node_id 18 for calling a global function with example usage: get_var(environ_cp, var_name, query_item, enabled_by_default, question, yes_reply, no_reply) and returns: var