sprint_varx fmt to support quote_values

- Added support to sprint_varx fmt arg for quote_values().
- Also changed comments and doc strings to wrap at 110 chars vs 79.

Change-Id: I26c3d5ff0a4eaf37283eca8a2bd3078074ca6172
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_print.py b/lib/gen_print.py
index 92dec7b..3bfb8aa 100755
--- a/lib/gen_print.py
+++ b/lib/gen_print.py
@@ -1,8 +1,7 @@
 #!/usr/bin/env python
 
 r"""
-This module provides many print functions such as sprint_var, sprint_time,
-sprint_error, sprint_call_stack.
+This module provides many print functions such as sprint_var, sprint_time, sprint_error, sprint_call_stack.
 """
 
 import sys
@@ -27,8 +26,8 @@
     from robot.utils import DotDict
     from robot.utils import NormalizedDict
     from robot.libraries.BuiltIn import BuiltIn
-    # Having access to the robot libraries alone does not indicate that we
-    # are in a robot environment.  The following try block should confirm that.
+    # Having access to the robot libraries alone does not indicate that we are in a robot environment.  The
+    # following try block should confirm that.
     try:
         var_value = BuiltIn().get_variable_value("${SUITE_NAME}", "")
     except BaseException:
@@ -38,25 +37,22 @@
 
 import gen_arg as ga
 
-# Setting these variables for use both inside this module and by programs
-# importing this module.
+# Setting these variables for use both inside this module and by programs importing this module.
 pgm_file_path = sys.argv[0]
 pgm_name = os.path.basename(pgm_file_path)
 pgm_dir_path = os.path.normpath(re.sub("/" + pgm_name, "", pgm_file_path)) +\
     os.path.sep
 
 
-# Some functions (e.g. sprint_pgm_header) have need of a program name value
-# that looks more like a valid variable name.  Therefore, we'll swap odd
-# characters like "." out for underscores.
+# Some functions (e.g. sprint_pgm_header) have need of a program name value that looks more like a valid
+# variable name.  Therefore, we'll swap odd characters like "." out for underscores.
 pgm_name_var_name = pgm_name.replace(".", "_")
 
 # Initialize global values used as defaults by print_time, print_var, etc.
 dft_indent = 0
 
-# Calculate default column width for print_var functions based on environment
-# variable settings.  The objective is to make the variable values line up
-# nicely with the time stamps.
+# Calculate default column width for print_var functions based on environment variable settings.  The
+# objective is to make the variable values line up nicely with the time stamps.
 dft_col1_width = 29
 
 NANOSECONDS = os.environ.get('NANOSECONDS', '1')
@@ -85,19 +81,16 @@
     Set the "last_seconds_ix" module variable to the index value.
 
     Description of argument(s):
-    ix                              The index value to be set into the module
-                                    global last_seconds_ix variable.
+    ix                              The index value to be set into the module global last_seconds_ix variable.
     """
     global last_seconds_ix
     last_seconds_ix = ix
 
 
-# Since output from the lprint_ functions goes to a different location than
-# the output from the print_ functions (e.g. a file vs. the console),
-# sprint_time_last_seconds has been created as a list rather than a simple
-# integer so that it can store multiple sprint_time_last_seconds values.
-# Standard print_ functions defined in this file will use
-# sprint_time_last_seconds[0] and the lprint_ functions will use
+# Since output from the lprint_ functions goes to a different location than the output from the print_
+# functions (e.g. a file vs. the console), sprint_time_last_seconds has been created as a list rather than a
+# simple integer so that it can store multiple sprint_time_last_seconds values.  Standard print_ functions
+# defined in this file will use sprint_time_last_seconds[0] and the lprint_ functions will use
 # sprint_time_last_seconds[1].
 def standard_print_last_seconds_ix():
     r"""
@@ -113,8 +106,7 @@
     return 1
 
 
-# The user can set environment variable "GEN_PRINT_DEBUG" to get debug output
-# from this module.
+# The user can set environment variable "GEN_PRINT_DEBUG" to get debug output from this module.
 gen_print_debug = int(os.environ.get('GEN_PRINT_DEBUG', 0))
 
 
@@ -123,18 +115,13 @@
     Return the function name associated with the indicated stack frame.
 
     Description of argument(s):
-    stack_frame_ix                  The index of the stack frame whose
-                                    function name should be returned.  If the
-                                    caller does not specify a value, this
-                                    function will set the value to 1 which is
-                                    the index of the caller's stack frame.  If
-                                    the caller is the wrapper function
-                                    "print_func_name", this function will bump
-                                    it up by 1.
+    stack_frame_ix                  The index of the stack frame whose function name should be returned.  If
+                                    the caller does not specify a value, this function will set the value to
+                                    1 which is the index of the caller's stack frame.  If the caller is the
+                                    wrapper function "print_func_name", this function will bump it up by 1.
     """
 
-    # If user specified no stack_frame_ix, we'll set it to a proper default
-    # value.
+    # If user specified no stack_frame_ix, we'll set it to a proper default value.
     if stack_frame_ix is None:
         func_name = sys._getframe().f_code.co_name
         caller_func_name = sys._getframe(1).f_code.co_name
@@ -150,15 +137,13 @@
 
 def work_around_inspect_stack_cwd_failure():
     r"""
-    Work around the inspect.stack() getcwd() failure by making "/tmp" the
+    Work around the inspect.stack() getcwd() failure by making "/tmp" the current working directory.
+
+    NOTES: If the current working directory has been deleted, inspect.stack() will fail with "OSError: [Errno
+    2] No such file or directory" because it tries to do a getcwd().
+
+    This function will try to prevent this failure by detecting the scenario in advance and making "/tmp" the
     current working directory.
-
-    NOTES: If the current working directory has been deleted, inspect.stack()
-    will fail with "OSError: [Errno 2] No such file or directory" because it
-    tries to do a getcwd().
-
-    This function will try to prevent this failure by detecting the scenario
-    in advance and making "/tmp" the current working directory.
     """
     try:
         os.getcwd()
@@ -174,52 +159,36 @@
     return len(line) - len(line.lstrip(' '))
 
 
-# get_arg_name is not a print function per se.  It has been included in this
-# module because it is used by sprint_var which is defined in this module.
+# get_arg_name is not a print function per se.  It has been included in this module because it is used by
+# sprint_var which is defined in this module.
 def get_arg_name(var,
                  arg_num=1,
                  stack_frame_ix=1):
     r"""
-    Return the "name" of an argument passed to a function.  This could be a
-    literal or a variable name.
+    Return the "name" of an argument passed to a function.  This could be a literal or a variable name.
 
     Description of argument(s):
     var                             The variable whose name is to be returned.
-    arg_num                         The arg number whose name is to be
-                                    returned.  To illustrate how arg_num is
-                                    processed, suppose that a programmer codes
-                                    this line: "rc, outbuf = my_func(var1,
-                                    var2)" and suppose that my_func has this
-                                    line of code: "result = gp.get_arg_name(0,
-                                    arg_num, 2)".  If arg_num is positive, the
-                                    indicated argument is returned.  For
-                                    example, if arg_num is 1, "var1" would be
-                                    returned, If arg_num is 2, "var2" would be
-                                    returned.  If arg_num exceeds the number
-                                    of arguments, get_arg_name will simply
-                                    return a complete list of the arguments.
-                                    If arg_num is 0, get_arg_name will return
-                                    the name of the target function as
-                                    specified in the calling line ("my_func"
-                                    in this case).  To clarify, if the caller
-                                    of the target function uses an alias
-                                    function name, the alias name would be
-                                    returned.  If arg_num is negative, an
-                                    lvalue variable name is returned.
-                                    Continuing with the given example, if
-                                    arg_num is -2 the 2nd parm to the left of
-                                    the "=" ("rc" in this case) should be
-                                    returned.  If arg_num is -1, the 1st parm
-                                    to the left of the "=" ("out_buf" in this
-                                    case) should be returned.  If arg_num is
-                                    less than -2, an entire dictionary is
-                                    returned.  The keys to the dictionary for
-                                    this example would be -2 and -1.
-    stack_frame_ix                  The stack frame index of the target
-                                    function.  This value must be 1 or
-                                    greater.  1 would indicate get_arg_name's
-                                    stack frame.  2 would be the caller of
-                                    get_arg_name's stack frame, etc.
+    arg_num                         The arg number whose name is to be returned.  To illustrate how arg_num
+                                    is processed, suppose that a programmer codes this line: "rc, outbuf =
+                                    my_func(var1, var2)" and suppose that my_func has this line of code:
+                                    "result = gp.get_arg_name(0, arg_num, 2)".  If arg_num is positive, the
+                                    indicated argument is returned.  For example, if arg_num is 1, "var1"
+                                    would be returned, If arg_num is 2, "var2" would be returned.  If arg_num
+                                    exceeds the number of arguments, get_arg_name will simply return a
+                                    complete list of the arguments.  If arg_num is 0, get_arg_name will
+                                    return the name of the target function as specified in the calling line
+                                    ("my_func" in this case).  To clarify, if the caller of the target
+                                    function uses an alias function name, the alias name would be returned.
+                                    If arg_num is negative, an lvalue variable name is returned.  Continuing
+                                    with the given example, if arg_num is -2 the 2nd parm to the left of the
+                                    "=" ("rc" in this case) should be returned.  If arg_num is -1, the 1st
+                                    parm to the left of the "=" ("out_buf" in this case) should be returned.
+                                    If arg_num is less than -2, an entire dictionary is returned.  The keys
+                                    to the dictionary for this example would be -2 and -1.
+    stack_frame_ix                  The stack frame index of the target function.  This value must be 1 or
+                                    greater.  1 would indicate get_arg_name's stack frame.  2 would be the
+                                    caller of get_arg_name's stack frame, etc.
 
     Example 1:
 
@@ -231,9 +200,8 @@
     Example 2:
 
     def test1(var):
-        # Getting the var name of the first arg to this function, test1.
-        # Note, in this case, it doesn't matter what is passed as the first
-        # arg to get_arg_name since it is the caller's variable name that
+        # Getting the var name of the first arg to this function, test1.  Note, in this case, it doesn't
+        # matter what is passed as the first arg to get_arg_name since it is the caller's variable name that
         # matters.
         dummy = 1
         arg_num = 1
@@ -249,15 +217,13 @@
 
     """
 
-    # Note: To avoid infinite recursion, avoid calling any function that
-    # calls this function (e.g. sprint_var, valid_value, etc.).
+    # Note: To avoid infinite recursion, avoid calling any function that calls this function (e.g.
+    # sprint_var, valid_value, etc.).
 
-    # The user can set environment variable "GET_ARG_NAME_DEBUG" to get debug
-    # output from this function.
+    # The user can set environment variable "GET_ARG_NAME_DEBUG" to get debug output from this function.
     local_debug = int(os.environ.get('GET_ARG_NAME_DEBUG', 0))
-    # In addition to GET_ARG_NAME_DEBUG, the user can set environment
-    # variable "GET_ARG_NAME_SHOW_SOURCE" to have this function include source
-    # code in the debug output.
+    # In addition to GET_ARG_NAME_DEBUG, the user can set environment variable "GET_ARG_NAME_SHOW_SOURCE" to
+    # have this function include source code in the debug output.
     local_debug_show_source = int(
         os.environ.get('GET_ARG_NAME_SHOW_SOURCE', 0))
 
@@ -294,10 +260,9 @@
             return
         if filename != "<string>":
             break
-        # filename of "<string>" may mean that the function in question was
-        # defined dynamically and therefore its code stack is inaccessible.
-        # This may happen with functions like "rqprint_var".  In this case,
-        # we'll increment the stack_frame_ix and try again.
+        # filename of "<string>" may mean that the function in question was defined dynamically and
+        # therefore its code stack is inaccessible.  This may happen with functions like "rqprint_var".  In
+        # this case, we'll increment the stack_frame_ix and try again.
         stack_frame_ix += 1
         if local_debug:
             print("Adjusted stack_frame_ix...")
@@ -307,9 +272,8 @@
 
     module = inspect.getmodule(frame)
 
-    # Though one would expect inspect.getsourcelines(frame) to get all module
-    # source lines if the frame is "<module>", it doesn't do that.  Therefore,
-    # for this special case, do inspect.getsourcelines(module).
+    # Though one would expect inspect.getsourcelines(frame) to get all module source lines if the frame is
+    # "<module>", it doesn't do that.  Therefore, for this special case, do inspect.getsourcelines(module).
     if function_name == "<module>":
         source_lines, source_line_num =\
             inspect.getsourcelines(module)
@@ -334,21 +298,19 @@
         print_varx("real_called_func_name", real_called_func_name,
                    indent=debug_indent)
 
-    # Get a list of all functions defined for the module.  Note that this
-    # doesn't work consistently when _run_exitfuncs is at the top of the stack
-    # (i.e. if we're running an exit function).  I've coded a work-around
-    # below for this deficiency.
+    # Get a list of all functions defined for the module.  Note that this doesn't work consistently when
+    # _run_exitfuncs is at the top of the stack (i.e. if we're running an exit function).  I've coded a
+    # work-around below for this deficiency.
     all_functions = inspect.getmembers(module, inspect.isfunction)
 
-    # Get called_func_id by searching for our function in the list of all
-    # functions.
+    # Get called_func_id by searching for our function in the list of all functions.
     called_func_id = None
     for func_name, function in all_functions:
         if func_name == real_called_func_name:
             called_func_id = id(function)
             break
-    # NOTE: The only time I've found that called_func_id can't be found is
-    # when we're running from an exit function.
+    # NOTE: The only time I've found that called_func_id can't be found is when we're running from an exit
+    # function.
 
     # Look for other functions in module with matching id.
     aliases = set([real_called_func_name])
@@ -359,23 +321,20 @@
         if func_id == called_func_id:
             aliases.add(func_name)
 
-    # In most cases, my general purpose code above will find all aliases.
-    # However, for the odd case (i.e. running from exit function), I've added
-    # code to handle pvar, qpvar, dpvar, etc. aliases explicitly since they
-    # are defined in this module and used frequently.
+    # In most cases, my general purpose code above will find all aliases.  However, for the odd case (i.e.
+    # running from exit function), I've added code to handle pvar, qpvar, dpvar, etc. aliases explicitly
+    # since they are defined in this module and used frequently.
     # pvar is an alias for print_var.
     aliases.add(re.sub("print_var", "pvar", real_called_func_name))
 
-    # The call to the function could be encased in a recast (e.g.
-    # int(func_name())).
+    # The call to the function could be encased in a recast (e.g. int(func_name())).
     recast_regex = "([^ ]+\\([ ]*)?"
     import_name_regex = "([a-zA-Z0-9_]+\\.)?"
     func_name_regex = recast_regex + import_name_regex + "(" +\
         '|'.join(aliases) + ")"
     pre_args_regex = ".*" + func_name_regex + "[ ]*\\("
 
-    # Search backward through source lines looking for the calling function
-    # name.
+    # Search backward through source lines looking for the calling function name.
     found = False
     for start_line_ix in range(line_ix, 0, -1):
         # Skip comment lines.
@@ -390,9 +349,8 @@
                     + "\".\n")
         return
 
-    # Search forward through the source lines looking for a line whose
-    # indentation is the same or less than the start line.  The end of our
-    # composite line should be the line preceding that line.
+    # Search forward through the source lines looking for a line whose indentation is the same or less than
+    # the start line.  The end of our composite line should be the line preceding that line.
     start_indent = get_line_indent(source_lines[start_line_ix])
     end_line_ix = line_ix
     for end_line_ix in range(line_ix + 1, len(source_lines)):
@@ -403,8 +361,7 @@
             end_line_ix -= 1
             break
     if start_line_ix != 0:
-        # Check to see whether the start line is a continuation of the prior
-        # line.
+        # Check to see whether the start line is a continuation of the prior line.
         prior_line = source_lines[start_line_ix - 1]
         prior_line_stripped = re.sub(r"[ ]*\\([\r\n]$)", " \\1", prior_line)
         prior_line_indent = get_line_indent(prior_line)
@@ -473,15 +430,14 @@
             if nest_level < 0:
                 break
 
-        # If we reach a comma at base nest level, we are done processing an
-        # argument so we increment arg_ix and initialize a new args_list entry.
+        # If we reach a comma at base nest level, we are done processing an argument so we increment arg_ix
+        # and initialize a new args_list entry.
         if char == "," and nest_level == 0:
             arg_ix += 1
             args_list.append("")
             continue
 
-        # For any other character, we append it it to the current arg list
-        # entry.
+        # For any other character, we append it it to the current arg list entry.
         args_list[arg_ix] += char
 
     # Trim whitespace from each list entry.
@@ -533,38 +489,28 @@
 
     #(CDT) 2016/08/03 17:12:05 - Hi.
 
-    The following environment variables will affect the formatting as
-    described:
-    NANOSECONDS                     This will cause the time stamps to be
-                                    precise to the microsecond (Yes, it
-                                    probably should have been named
-                                    MICROSECONDS but the convention was set
-                                    long ago so we're sticking with it).
-                                    Example of the output when environment
-                                    variable NANOSECONDS=1.
+    The following environment variables will affect the formatting as described:
+    NANOSECONDS                     This will cause the time stamps to be precise to the microsecond (Yes, it
+                                    probably should have been named MICROSECONDS but the convention was set
+                                    long ago so we're sticking with it).  Example of the output when
+                                    environment variable NANOSECONDS=1.
 
     #(CDT) 2016/08/03 17:16:25.510469 - Hi.
 
-    SHOW_ELAPSED_TIME               This will cause the elapsed time to be
-                                    included in the output.  This is the
-                                    amount of time that has elapsed since the
-                                    last time this function was called.  The
-                                    precision of the elapsed time field is
-                                    also affected by the value of the
-                                    NANOSECONDS environment variable.  Example
-                                    of the output when environment variable
-                                    NANOSECONDS=0 and SHOW_ELAPSED_TIME=1.
+    SHOW_ELAPSED_TIME               This will cause the elapsed time to be included in the output.  This is
+                                    the amount of time that has elapsed since the last time this function was
+                                    called.  The precision of the elapsed time field is also affected by the
+                                    value of the NANOSECONDS environment variable.  Example of the output
+                                    when environment variable NANOSECONDS=0 and SHOW_ELAPSED_TIME=1.
 
     #(CDT) 2016/08/03 17:17:40 -    0 - Hi.
 
-    Example of the output when environment variable NANOSECONDS=1 and
-    SHOW_ELAPSED_TIME=1.
+    Example of the output when environment variable NANOSECONDS=1 and SHOW_ELAPSED_TIME=1.
 
     #(CDT) 2016/08/03 17:18:47.317339 -    0.000046 - Hi.
 
     Description of argument(s).
-    buffer                          This will be appended to the formatted
-                                    time string.
+    buffer                          This will be appended to the formatted time string.
     """
 
     global NANOSECONDS
@@ -599,8 +545,7 @@
 
 def sprint_timen(buffer=""):
     r"""
-    Append a line feed to the buffer, pass it to sprint_time and return the
-    result.
+    Append a line feed to the buffer, pass it to sprint_time and return the result.
     """
 
     return sprint_time(buffer + "\n")
@@ -624,8 +569,7 @@
     #(CDT) 2016/08/03 17:12:05 - **ERROR** Oops.
 
     Description of argument(s).
-    buffer                          This will be appended to the formatted
-                                    error string.
+    buffer                          This will be appended to the formatted error string.
     """
 
     return sprint_time() + "**ERROR** " + buffer
@@ -657,17 +601,14 @@
     """
 
     if number < 0:
-        # Convert negative numbers to positive and subtract one.  The
-        # following example illustrates the reason for this:
-        # Consider a single nibble whose signed values can range from -8 to 7
-        # (0x8 to 0x7).  A value of 0x7 equals 0b0111.  Therefore, its length
-        # in bits is 3.  Since the negative bit (i.e. 0b1000) is not set, the
-        # value 7 clearly will fit in one nibble.  With -8 = 0x8 = 0b1000, one
-        # has the smallest negative value that will fit.  Note that it
-        # requires 3 bits of 0.  So by converting a number value of -8 to a
-        # working_number of 7, this function can accurately calculate the
-        # number of bits and therefore nibbles required to represent the
-        # number in print.
+        # Convert negative numbers to positive and subtract one.  The following example illustrates the
+        # reason for this:
+        # Consider a single nibble whose signed values can range from -8 to 7 (0x8 to 0x7).  A value of 0x7
+        # equals 0b0111.  Therefore, its length in bits is 3.  Since the negative bit (i.e. 0b1000) is not
+        # set, the value 7 clearly will fit in one nibble.  With -8 = 0x8 = 0b1000, one has the smallest
+        # negative value that will fit.  Note that it requires 3 bits of 0.  So by converting a number value
+        # of -8 to a working_number of 7, this function can accurately calculate the number of bits and
+        # therefore nibbles required to represent the number in print.
         working_number = abs(number) - 1
     else:
         working_number = number
@@ -681,8 +622,7 @@
 
 def get_req_num_hex_digits(number):
     r"""
-    Return the required number of hex digits required to display the given
-    number.
+    Return the required number of hex digits required to display the given number.
 
     The returned value will always be rounded up to the nearest multiple of 8.
 
@@ -691,17 +631,14 @@
     """
 
     if number < 0:
-        # Convert negative numbers to positive and subtract one.  The
-        # following example illustrates the reason for this:
-        # Consider a single nibble whose signed values can range from -8 to 7
-        # (0x8 to 0x7).  A value of 0x7 equals 0b0111.  Therefore, its length
-        # in bits is 3.  Since the negative bit (i.e. 0b1000) is not set, the
-        # value 7 clearly will fit in one nibble.  With -8 = 0x8 = 0b1000, one
-        # has the smallest negative value that will fit.  Note that it
-        # requires 3 bits of 0.  So by converting a number value of -8 to a
-        # working_number of 7, this function can accurately calculate the
-        # number of bits and therefore nibbles required to represent the
-        # number in print.
+        # Convert negative numbers to positive and subtract one.  The following example illustrates the
+        # reason for this:
+        # Consider a single nibble whose signed values can range from -8 to 7 (0x8 to 0x7).  A value of 0x7
+        # equals 0b0111.  Therefore, its length in bits is 3.  Since the negative bit (i.e. 0b1000) is not
+        # set, the value 7 clearly will fit in one nibble.  With -8 = 0x8 = 0b1000, one has the smallest
+        # negative value that will fit.  Note that it requires 3 bits of 0.  So by converting a number value
+        # of -8 to a working_number of 7, this function can accurately calculate the number of bits and
+        # therefore nibbles required to represent the number in print.
         working_number = abs(number) - 1
     else:
         working_number = number
@@ -714,18 +651,15 @@
     num_hex_digits, remainder = divmod(num_length_in_bits,
                                        digit_length_in_bits())
     if remainder > 0:
-        # Example: the number 7 requires 3 bits.  The divmod above produces,
-        # 0 with remainder of 3.  So because we have a remainder, we increment
-        # num_hex_digits from 0 to 1.
+        # Example: the number 7 requires 3 bits.  The divmod above produces, 0 with remainder of 3.  So
+        # because we have a remainder, we increment num_hex_digits from 0 to 1.
         num_hex_digits += 1
 
-    # Check to see whether the negative bit is set.  This is the left-most
-    # bit in the highest order digit.
+    # Check to see whether the negative bit is set.  This is the left-most bit in the highest order digit.
     negative_mask = 2 ** (num_hex_digits * 4 - 1)
     if working_number & negative_mask:
-        # If a number that is intended to be positive has its negative bit
-        # on, an additional digit will be required to represent it correctly
-        # in print.
+        # If a number that is intended to be positive has its negative bit on, an additional digit will be
+        # required to represent it correctly in print.
         num_hex_digits += 1
 
     num_words, remainder = divmod(num_hex_digits, word_length_in_digits())
@@ -738,8 +672,7 @@
 
 def dft_num_hex_digits():
     r"""
-    Return the default number of hex digits to be used to represent a hex
-    number in print.
+    Return the default number of hex digits to be used to represent a hex number in print.
 
     The value returned is a function of sys.maxsize.
     """
@@ -777,13 +710,12 @@
     r"""
     Return non-zero if var_value is a type of dictionary and 0 if it is not.
 
-    The specific non-zero value returned will indicate what type of dictionary
-    var_value is (see constant functions above).
+    The specific non-zero value returned will indicate what type of dictionary var_value is (see constant
+    functions above).
 
     Description of argument(s):
-    var_value                       The object to be analyzed to determine
-                                    whether it is a dictionary and if so, what
-                                    type of dictionary.
+    var_value                       The object to be analyzed to determine whether it is a dictionary and if
+                                    so, what type of dictionary.
     """
 
     if isinstance(var_value, dict):
@@ -813,8 +745,7 @@
 
 def get_int_types():
     r"""
-    Return a tuple consisting of the valid integer data types for the system
-    and version of python being run.
+    Return a tuple consisting of the valid integer data types for the system and version of python being run.
 
     Example:
     (int, long)
@@ -829,8 +760,7 @@
 
 def get_string_types():
     r"""
-    Return a tuple consisting of the valid string data types for the system
-    and version of python being run.
+    Return a tuple consisting of the valid string data types for the system and version of python being run.
 
     Example:
     (str, unicode)
@@ -845,8 +775,8 @@
 
 def valid_fmts():
     r"""
-    Return a list of the valid formats that can be specified for the fmt
-    argument of the sprint_varx function (defined below).
+    Return a list of the valid formats that can be specified for the fmt argument of the sprint_varx function
+    (defined below).
     """
 
     return [
@@ -858,19 +788,19 @@
         'quote_keys',
         'show_type',
         'strip_brackets',
-        'no_header']
+        'no_header',
+        'quote_values']
 
 
 def create_fmt_definition():
     r"""
-    Create a string consisting of function-definition code that can be
-    executed to create constant fmt definition functions.
+    Create a string consisting of function-definition code that can be executed to create constant fmt
+    definition functions.
 
-    These functions can be used by callers of sprint_var/sprint_varx to set
-    the fmt argument correctly.
+    These functions can be used by callers of sprint_var/sprint_varx to set the fmt argument correctly.
 
-    Likewise, the sprint_varx function will use these generated functions to
-    correctly interpret the fmt argument.
+    Likewise, the sprint_varx function will use these generated functions to correctly interpret the fmt
+    argument.
 
     Example output from this function:
 
@@ -890,8 +820,7 @@
     return buffer
 
 
-# Dynamically create fmt definitions (for use with the fmt argument of
-# sprint_varx function):
+# Dynamically create fmt definitions (for use with the fmt argument of sprint_varx function):
 exec(create_fmt_definition())
 
 
@@ -899,11 +828,10 @@
     r"""
     Constant function to return fmt value of 0.
 
-    Now that sprint_varx defaults to printing in terse format, the terse
-    option is deprecated.  This function is here for backward compatibility.
+    Now that sprint_varx defaults to printing in terse format, the terse option is deprecated.  This function
+    is here for backward compatibility.
 
-    Once the repo has been purged of the use of terse, this function can be
-    removed.
+    Once the repo has been purged of the use of terse, this function can be removed.
     """
 
     return 0
@@ -911,18 +839,14 @@
 
 def list_pop(a_list, index=0, default=None):
     r"""
-    Pop the list entry indicated by the index and return the entry.  If no
-    such entry exists, return default.
+    Pop the list entry indicated by the index and return the entry.  If no such entry exists, return default.
 
     Note that the list passed to this function will be modified.
 
     Description of argument(s):
-    a_list                          The list from which an entry is to be
-                                    popped.
-    index                           The index indicating which entry is to be
-                                    popped.
-    default                         The value to be returned if there is no
-                                    entry at the given index location.
+    a_list                          The list from which an entry is to be popped.
+    index                           The index indicating which entry is to be popped.
+    default                         The value to be returned if there is no entry at the given index location.
     """
     try:
         return a_list.pop(index)
@@ -932,17 +856,14 @@
 
 def parse_fmt(fmt):
     r"""
-    Parse the fmt argument and return a tuple consisting of a format and a
-    child format.
+    Parse the fmt argument and return a tuple consisting of a format and a child format.
 
-    This function was written for use by the sprint_varx function defined in
-    this module.
+    This function was written for use by the sprint_varx function defined in this module.
 
-    When sprint_varx is processing a multi-level object such as a list or
-    dictionary (which in turn may contain other lists or dictionaries), it
-    will use the fmt value to dictate the print formatting of the current
-    level and the child_fmt value to dictate the print formatting of
-    subordinate levels.  Consider the following example:
+    When sprint_varx is processing a multi-level object such as a list or dictionary (which in turn may
+    contain other lists or dictionaries), it will use the fmt value to dictate the print formatting of the
+    current level and the child_fmt value to dictate the print formatting of subordinate levels.  Consider
+    the following example:
 
     python code example:
 
@@ -965,14 +886,12 @@
         [three]:                 3
         [four]:                  4
 
-    The first level in this example is the line that simply says "ord_dict".
-    The second level is comprised of the dictionary entries with the keys
-    'one', 'two' and 'sub'.  The third level is comprised of the last 2 lines
-    (i.e. printed values 3 and 4).
+    The first level in this example is the line that simply says "ord_dict".  The second level is comprised
+    of the dictionary entries with the keys 'one', 'two' and 'sub'.  The third level is comprised of the last
+    2 lines (i.e. printed values 3 and 4).
 
-    Given the data structure shown above, the programmer could code the
-    following where fmt is a simple integer value set by calling the verbose()
-    function.
+    Given the data structure shown above, the programmer could code the following where fmt is a simple
+    integer value set by calling the verbose() function.
 
     print_var(ord_dict, fmt=verbose())
 
@@ -985,17 +904,14 @@
         ord_dict[sub][three]:    3
         ord_dict[sub][four]:     4
 
-    Note the verbose format where the name of the object ("ord_dict") is
-    repeated on every line.
+    Note the verbose format where the name of the object ("ord_dict") is repeated on every line.
 
-    If the programmer wishes to get more granular with the fmt argument,
-    he/she can specify it as a list where each entry corresponds to a level of
-    the object being printed.  The last such list entry governs the print
-    formatting of all subordinate parts of the given object.
+    If the programmer wishes to get more granular with the fmt argument, he/she can specify it as a list
+    where each entry corresponds to a level of the object being printed.  The last such list entry governs
+    the print formatting of all subordinate parts of the given object.
 
-    Look at each of the following code examples and their corresponding
-    output.  See how the show_type() formatting affects the printing depending
-    on which position it occupies in the fmt list argument:
+    Look at each of the following code examples and their corresponding output.  See how the show_type()
+    formatting affects the printing depending on which position it occupies in the fmt list argument:
 
     print_var(ord_dict, fmt=[show_type()])
 
@@ -1025,20 +941,19 @@
         ord_dict[sub][four]:     4 <int>
 
     Description of argument(s):
-    fmt                             The format argument such as is passed to
-                                    sprint_varx.  This argument may be an
-                                    integer or a list of integers.  See the
-                                    prolog of sprint_varx for more details.
+    fmt                             The format argument such as is passed to sprint_varx.  This argument may
+                                    be an integer or a list of integers.  See the prolog of sprint_varx for
+                                    more details.
     """
 
-    # Make a deep copy of the fmt argument in order to avoid modifying the
-    # caller's fmt value when it is a list.
+    # Make a deep copy of the fmt argument in order to avoid modifying the caller's fmt value when it is a
+    # list.
     fmt = copy.deepcopy(fmt)
     try:
         # Assume fmt is a list.  Pop the first element from the list.
         first_element = list_pop(fmt, index=0, default=0)
-        # Return the first list element along with either 1) the remainder of
-        # the fmt list if not null or 2) another copy of the first element.
+        # Return the first list element along with either 1) the remainder of the fmt list if not null or 2)
+        # another copy of the first element.
         return first_element, fmt if len(fmt) else first_element
     except AttributeError:
         # fmt is not a list so treat it as a simple integer value.
@@ -1054,14 +969,12 @@
                 key_list=None,
                 delim=":"):
     r"""
-    Print the var name/value passed to it.  If the caller lets col1_width
-    default, the printing lines up nicely with output generated by the
-    print_time functions.
+    Print the var name/value passed to it.  If the caller lets col1_width default, the printing lines up
+    nicely with output generated by the print_time functions.
 
-    Note that the sprint_var function (defined below) can be used to call this
-    function so that the programmer does not need to pass the var_name.
-    sprint_var will figure out the var_name.  The sprint_var function is the
-    one that would normally be used by the general user.
+    Note that the sprint_var function (defined below) can be used to call this function so that the
+    programmer does not need to pass the var_name.  sprint_var will figure out the var_name.  The sprint_var
+    function is the one that would normally be used by the general user.
 
     For example, the following python code:
 
@@ -1076,8 +989,7 @@
     first_name:                                       Mike
     #(CDT) 2016/08/10 17:34:42.847510 -    0.000136 - Doing that...
 
-    This function recognizes several complex types of data such as dict, list
-    or tuple.
+    This function recognizes several complex types of data such as dict, list or tuple.
 
     For example, the following python code:
 
@@ -1094,76 +1006,50 @@
     Description of argument(s).
     var_name                        The name of the variable to be printed.
     var_value                       The value of the variable to be printed.
-    fmt                             A bit map to dictate the format of the
-                                    output.  For printing multi-level objects
-                                    like lists and dictionaries, this argument
-                                    may also be a list of bit maps.  The first
-                                    list element pertains to the highest level
-                                    of output, the second element pertains to
-                                    the 2nd level of output, etc.  The last
-                                    element in the list pertains to all
-                                    subordinate levels.  The bits can be set
-                                    using the dynamically created functionhs
-                                    above.  Example: sprint_varx("var1", var1,
-                                    fmt=verbose()).  Note that these values
-                                    can be OR'ed together: print_var(var1,
-                                    hexa() | verbose()).  If the caller ORs
-                                    mutually exclusive bits (hexa() |
-                                    octal()), behavior is not guaranteed.  The
-                                    following features are supported:
-        hexa                        Print all integer values in hexadecimal
-                                    format.
+    fmt                             A bit map to dictate the format of the output.  For printing multi-level
+                                    objects like lists and dictionaries, this argument may also be a list of
+                                    bit maps.  The first list element pertains to the highest level of
+                                    output, the second element pertains to the 2nd level of output, etc.  The
+                                    last element in the list pertains to all subordinate levels.  The bits
+                                    can be set using the dynamically created functionhs above.  Example:
+                                    sprint_varx("var1", var1, fmt=verbose()).  Note that these values can be
+                                    OR'ed together: print_var(var1, hexa() | verbose()).  If the caller ORs
+                                    mutually exclusive bits (hexa() | octal()), behavior is not guaranteed.
+                                    The following features are supported:
+        hexa                        Print all integer values in hexadecimal format.
         octal                       Print all integer values in octal format.
         binary                      Print all integer values in binary format.
-        blank                       For blank string values, print "<blank>"
-                                    instead of an actual blank.
-        verbose                     For structured values like dictionaries,
-                                    lists, etc. repeat the name of the
-                                    variable on each line to the right of the
-                                    key or subscript value.  Example: print
-                                    "my_dict[key1]" instead of just "[key1]".
-        quote_keys                  Quote dictionary keys in the output.
-                                    Example: my_dict['key1'] instead of
+        blank                       For blank string values, print "<blank>" instead of an actual blank.
+        verbose                     For structured values like dictionaries, lists, etc. repeat the name of
+                                    the variable on each line to the right of the key or subscript value.
+                                    Example: print "my_dict[key1]" instead of just "[key1]".
+        quote_keys                  Quote dictionary keys in the output.  Example: my_dict['key1'] instead of
                                     my_dict[key1].
-        show_type                   Show the type of the data in angled
-                                    brackets just to the right of the data.
-        strip_brackets              Strip the brackets from the variable name
-                                    portion of the output.  This is applicable
-                                    when printing complex objects like lists
-                                    or dictionaries.
-        no_header                   For complex objects like dictionaries, do
-                                    not include a header line.  This
-                                    necessarily means that the member lines
-                                    will be indented 2 characters less than
-                                    they otherwise would have been.
+        show_type                   Show the type of the data in angled brackets just to the right of the
+                                    data.
+        strip_brackets              Strip the brackets from the variable name portion of the output.  This is
+                                    applicable when printing complex objects like lists or dictionaries.
+        no_header                   For complex objects like dictionaries, do not include a header line.
+                                    This necessarily means that the member lines will be indented 2
+                                    characters less than they otherwise would have been.
+        quote_values                Quote the values printed.
     indent                          The number of spaces to indent the output.
-    col1_width                      The width of the output column containing
-                                    the variable name.  The default value of
-                                    this is adjusted so that the var_value
-                                    lines up with text printed via the
-                                    print_time function.
-    trailing_char                   The character to be used at the end of the
-                                    returned string.  The default value is a
-                                    line feed.
-    key_list                        A list of which dictionary keys should be
-                                    printed.  All others keys will be skipped.
-                                    Each value in key_list will be regarded
-                                    as a regular expression and it will be
-                                    regarded as anchored to the beginning and
-                                    ends of the dictionary key being
-                                    referenced.  For example if key_list is
-                                    ["one", "two"], the resulting regex used
-                                    will be "^one|two$", i.e. only keys "one"
-                                    and "two" from the var_value dictionary
-                                    will be printed.  As another example, if
-                                    the caller were to specify a key_list of
-                                    ["one.*"], then only dictionary keys whose
-                                    names begin with "one" will be printed.
-                                    Note: This argument pertains only to
-                                    var_values which are dictionaries.
-    delim                           The value to be used to delimit the
-                                    variable name from the variable value in
-                                    the output.
+    col1_width                      The width of the output column containing the variable name.  The default
+                                    value of this is adjusted so that the var_value lines up with text
+                                    printed via the print_time function.
+    trailing_char                   The character to be used at the end of the returned string.  The default
+                                    value is a line feed.
+    key_list                        A list of which dictionary keys should be printed.  All others keys will
+                                    be skipped.  Each value in key_list will be regarded as a regular
+                                    expression and it will be regarded as anchored to the beginning and ends
+                                    of the dictionary key being referenced.  For example if key_list is
+                                    ["one", "two"], the resulting regex used will be "^one|two$", i.e. only
+                                    keys "one" and "two" from the var_value dictionary will be printed.  As
+                                    another example, if the caller were to specify a key_list of ["one.*"],
+                                    then only dictionary keys whose names begin with "one" will be printed.
+                                    Note: This argument pertains only to var_values which are dictionaries.
+    delim                           The value to be used to delimit the variable name from the variable value
+                                    in the output.
     """
 
     fmt, child_fmt = parse_fmt(fmt)
@@ -1176,8 +1062,7 @@
     simple_types = int_types + string_types + (float, bool, type, type(None))
     # Determine the type.
     if type(var_value) in simple_types:
-        # The data type is simple in the sense that it has no subordinate
-        # parts.
+        # The data type is simple in the sense that it has no subordinate parts.
         # Adjust col1_width.
         col1_width = col1_width - indent
         # Set default value for value_format.
@@ -1188,9 +1073,8 @@
             if fmt & hexa():
                 num_hex_digits = max(dft_num_hex_digits(),
                                      get_req_num_hex_digits(var_value))
-                # Convert a negative number to its positive twos complement
-                # for proper printing.  For example, instead of printing -1 as
-                # "0x-000000000000001" it will be printed as
+                # Convert a negative number to its positive twos complement for proper printing.  For
+                # example, instead of printing -1 as "0x-000000000000001" it will be printed as
                 # "0xffffffffffffffff".
                 var_value = var_value & (2 ** (num_hex_digits * 4) - 1)
                 value_format = "0x%0" + str(num_hex_digits) + "x"
@@ -1220,6 +1104,8 @@
                 format_string += " "
             format_string += type_str
         format_string += trailing_char
+        if fmt & quote_values():
+            var_value = "'" + var_value + "'"
         if not (fmt & verbose()):
             # Strip everything leading up to the first left square brace.
             var_name = re.sub(r".*\[", "[", var_name)
@@ -1312,8 +1198,8 @@
 
 def sprint_var(*args, **kwargs):
     r"""
-    Figure out the name of the first argument for the caller and then call
-    sprint_varx with it.  Therefore, the following 2 calls are equivalent:
+    Figure out the name of the first argument for the caller and then call sprint_varx with it.  Therefore,
+    the following 2 calls are equivalent:
     sprint_varx("var1", var1)
     sprint_var(var1)
 
@@ -1334,10 +1220,8 @@
     Sprint the values of one or more variables.
 
     Description of argument(s):
-    args                            The variable values which are to be
-                                    printed.
-    kwargs                          See sprint_varx (above) for description of
-                                    additional arguments.
+    args                            The variable values which are to be printed.
+    kwargs                          See sprint_varx (above) for description of additional arguments.
     """
 
     stack_frame = 2
@@ -1363,13 +1247,10 @@
     Return a string of dashes to the caller.
 
     Description of argument(s):
-    indent                          The number of characters to indent the
-                                    output.
+    indent                          The number of characters to indent the output.
     width                           The width of the string of dashes.
-    line_feed                       Indicates whether the output should end
-                                    with a line feed.
-    char                            The character to be repeated in the output
-                                    string.
+    line_feed                       Indicates whether the output should end with a line feed.
+    char                            The character to be repeated in the output string.
     """
 
     width = int(width)
@@ -1383,13 +1264,11 @@
 def sindent(text="",
             indent=0):
     r"""
-    Pre-pend the specified number of characters to the text string (i.e.
-    indent it) and return it.
+    Pre-pend the specified number of characters to the text string (i.e. indent it) and return it.
 
     Description of argument(s):
     text                            The string to be indented.
-    indent                          The number of characters to indent the
-                                    string.
+    indent                          The number of characters to indent the string.
     """
 
     format_string = "%" + str(indent) + "s%s"
@@ -1404,28 +1283,22 @@
 
 def sprint_func_line(stack_frame, style=None):
     r"""
-    For the given stack_frame, return a formatted string containing the
-    function name and all its arguments.
+    For the given stack_frame, return a formatted string containing the function name and all its arguments.
 
     Example:
 
     func1(last_name = 'walsh', first_name = 'mikey')
 
     Description of argument(s):
-    stack_frame                     A stack frame (such as is returned by
-                                    inspect.stack()).
-    style                           Indicates the style or formatting of the
-                                    result string.  Acceptable values are
-                                    shown above.
+    stack_frame                     A stack frame (such as is returned by inspect.stack()).
+    style                           Indicates the style or formatting of the result string.  Acceptable
+                                    values are shown above.
 
     Description of styles:
     func_line_style_std             The standard formatting.
-    func_line_style_short           1) The self parm (associated with methods)
-                                    will be dropped. 2) The args and kwargs
-                                    values will be treated as special.  In
-                                    both cases the arg name ('args' or
-                                    'kwargs') will be dropped and only the
-                                    values will be shown.
+    func_line_style_short           1) The self parm (associated with methods) will be dropped. 2) The args
+                                    and kwargs values will be treated as special.  In both cases the arg name
+                                    ('args' or 'kwargs') will be dropped and only the values will be shown.
     """
 
     func_name = str(stack_frame[3])
@@ -1434,8 +1307,7 @@
         func_name = "(none)"
 
     if func_name == "<module>":
-        # If the func_name is the "main" program, we simply get the command
-        # line call string.
+        # If the func_name is the "main" program, we simply get the command line call string.
         func_and_args = ' '.join(sys.argv)
     else:
         # Get the program arguments.
@@ -1477,8 +1349,8 @@
                       stack_frame_ix=0,
                       style=None):
     r"""
-    Return a call stack report for the given point in the program with line
-    numbers, function names and function parameters and arguments.
+    Return a call stack report for the given point in the program with line numbers, function names and
+    function parameters and arguments.
 
     Sample output:
 
@@ -1494,12 +1366,9 @@
     -------------------------------------------------------------------------
 
     Description of argument(s):
-    indent                          The number of characters to indent each
-                                    line of output.
-    stack_frame_ix                  The index of the first stack frame which
-                                    is to be returned.
-    style                           See the sprint_line_func prolog above for
-                                    details.
+    indent                          The number of characters to indent each line of output.
+    stack_frame_ix                  The index of the first stack frame which is to be returned.
+    style                           See the sprint_line_func prolog above for details.
     """
 
     buffer = ""
@@ -1519,8 +1388,7 @@
         if ix < stack_frame_ix:
             ix += 1
             continue
-        # Make the line number shown to be the line where one finds the line
-        # shown.
+        # Make the line number shown to be the line where one finds the line shown.
         try:
             line_num = str(current_stack[ix + 1][2])
         except IndexError:
@@ -1537,24 +1405,19 @@
 
 def sprint_executing(stack_frame_ix=None, style=None):
     r"""
-    Print a line indicating what function is executing and with what parameter
-    values.  This is useful for debugging.
+    Print a line indicating what function is executing and with what parameter values.  This is useful for
+    debugging.
 
     Sample output:
 
     #(CDT) 2016/08/25 17:54:27 - Executing: func1(x = 1)
 
     Description of argument(s):
-    stack_frame_ix                  The index of the stack frame whose
-                                    function info should be returned.  If the
-                                    caller does not specify a value, this
-                                    function will set the value to 1 which is
-                                    the index of the caller's stack frame.  If
-                                    the caller is the wrapper function
-                                    "print_executing", this function will bump
-                                    it up by 1.
-    style                           See the sprint_line_func prolog above for
-                                    details.
+    stack_frame_ix                  The index of the stack frame whose function info should be returned.  If
+                                    the caller does not specify a value, this function will set the value to
+                                    1 which is the index of the caller's stack frame.  If the caller is the
+                                    wrapper function "print_executing", this function will bump it up by 1.
+    style                           See the sprint_line_func prolog above for details.
     """
 
     # If user wants default stack_frame_ix.
@@ -1577,15 +1440,13 @@
 def sprint_pgm_header(indent=0,
                       linefeed=1):
     r"""
-    Return a standardized header that programs should print at the beginning
-    of the run.  It includes useful information like command line, pid,
-    userid, program parameters, etc.
+    Return a standardized header that programs should print at the beginning of the run.  It includes useful
+    information like command line, pid, userid, program parameters, etc.
 
     Description of argument(s):
-    indent                          The number of characters to indent each
-                                    line of output.
-    linefeed                        Indicates whether a line feed be included
-                                    at the beginning and end of the report.
+    indent                          The number of characters to indent each line of output.
+    linefeed                        Indicates whether a line feed be included at the beginning and end of the
+                                    report.
     """
 
     col1_width = dft_col1_width + indent
@@ -1604,9 +1465,8 @@
                       indent)
     buffer += sprint_varx("command_line", ' '.join(sys.argv), 0, indent,
                           col1_width)
-    # We want the output to show a customized name for the pid and pgid but
-    # we want it to look like a valid variable name.  Therefore, we'll use
-    # pgm_name_var_name which was set when this module was imported.
+    # We want the output to show a customized name for the pid and pgid but we want it to look like a valid
+    # variable name.  Therefore, we'll use pgm_name_var_name which was set when this module was imported.
     buffer += sprint_varx(pgm_name_var_name + "_pid", os.getpid(), 0, indent,
                           col1_width)
     buffer += sprint_varx(pgm_name_var_name + "_pgid", os.getpgrp(), 0, indent,
@@ -1648,8 +1508,7 @@
 
     # TODO: Add code to print caller's parms.
 
-    # __builtin__.arg_obj is created by the get_arg module function,
-    # gen_get_options.
+    # __builtin__.arg_obj is created by the get_arg module function, gen_get_options.
     try:
         buffer += ga.sprint_args(__builtin__.arg_obj, indent)
     except AttributeError:
@@ -1677,21 +1536,17 @@
                         format=None,
                         stack_frame_ix=None):
     r"""
-    Return a string with a standardized report which includes the caller's
-    error text, the call stack and the program header.
+    Return a string with a standardized report which includes the caller's error text, the call stack and the
+    program header.
 
     Description of argument(s):
-    error_text                      The error text to be included in the
-                                    report.  The caller should include any
-                                    needed linefeeds.
-    indent                          The number of characters to indent each
-                                    line of output.
-    format                          Long or short format.  Long includes
-                                    extras like lines of dashes, call stack,
-                                    etc.
-    stack_frame_ix                  The index of the first stack frame which
-                                    is to be shown in the print_call_stack
-                                    portion of the error report.
+    error_text                      The error text to be included in the report.  The caller should include
+                                    any needed linefeeds.
+    indent                          The number of characters to indent each line of output.
+    format                          Long or short format.  Long includes extras like lines of dashes, call
+                                    stack, etc.
+    stack_frame_ix                  The index of the first stack frame which is to be shown in the
+                                    print_call_stack portion of the error report.
     """
 
     # Process input.
@@ -1711,9 +1566,8 @@
     buffer += sprint_error(error_text)
     buffer += "\n"
     if not stack_frame_ix:
-        # Calling sprint_call_stack with stack_frame_ix of 0 causes it to
-        # show itself and this function in the call stack.  This is not
-        # helpful to a debugger and is therefore clutter.  We will adjust the
+        # Calling sprint_call_stack with stack_frame_ix of 0 causes it to show itself and this function in
+        # the call stack.  This is not helpful to a debugger and is therefore clutter.  We will adjust the
         # stack_frame_ix to hide that information.
         stack_frame_ix = 1
         caller_func_name = sprint_func_name(1)
@@ -1740,8 +1594,7 @@
 
     Description of argument(s):
     cmd_buf                         The command to be executed by caller.
-    test_mode                       With test_mode set, the output will look
-                                    like this:
+    test_mode                       With test_mode set, the output will look like this:
 
     #(CDT) 2016/08/25 17:57:36 - (test_mode) Issuing: ls
 
@@ -1760,8 +1613,8 @@
 
 def sprint_pgm_footer():
     r"""
-    Return a standardized footer that programs should print at the end of the
-    program run.  It includes useful information like total run time, etc.
+    Return a standardized footer that programs should print at the end of the program run.  It includes
+    useful information like total run time, etc.
     """
 
     buffer = "\n" + sprint_time() + "Finished running " + pgm_name + ".\n\n"
@@ -1777,9 +1630,8 @@
 
 def sprint(buffer=""):
     r"""
-    Simply return the user's buffer.  This function is used by the qprint and
-    dprint functions defined dynamically below, i.e. it would not normally be
-    called for general use.
+    Simply return the user's buffer.  This function is used by the qprint and dprint functions defined
+    dynamically below, i.e. it would not normally be called for general use.
 
     Description of argument(s).
     buffer                          This will be returned to the caller.
@@ -1793,9 +1645,8 @@
 
 def sprintn(buffer=""):
     r"""
-    Simply return the user's buffer with a line feed.  This function is used
-    by the qprint and dprint functions defined dynamically below, i.e. it
-    would not normally be called for general use.
+    Simply return the user's buffer with a line feed.  This function is used by the qprint and dprint
+    functions defined dynamically below, i.e. it would not normally be called for general use.
 
     Description of argument(s).
     buffer                          This will be returned to the caller.
@@ -1812,8 +1663,8 @@
 def gp_print(buffer,
              stream='stdout'):
     r"""
-    Print the buffer using either sys.stdout.write or BuiltIn().log_to_console
-    depending on whether we are running in a robot environment.
+    Print the buffer using either sys.stdout.write or BuiltIn().log_to_console depending on whether we are
+    running in a robot environment.
 
     This function is intended for use only by other functions in this module.
 
@@ -1835,8 +1686,8 @@
 
 def gp_log(buffer):
     r"""
-    Log the buffer using either python logging or BuiltIn().log depending on
-    whether we are running in a robot environment.
+    Log the buffer using either python logging or BuiltIn().log depending on whether we are running in a
+    robot environment.
 
     This function is intended for use only by other functions in this module.
 
@@ -1874,18 +1725,15 @@
 
     If var_value is not None, it will simply be returned.
 
-    If var_value is None, this function will return the corresponding global
-    value of the variable in question.
+    If var_value is None, this function will return the corresponding global value of the variable in
+    question.
 
-    Note: For global values, if we are in a robot environment,
-    get_variable_value will be used.  Otherwise, the __builtin__ version of
-    the variable is returned (which are set by gen_arg.py functions).
+    Note: For global values, if we are in a robot environment, get_variable_value will be used.  Otherwise,
+    the __builtin__ version of the variable is returned (which are set by gen_arg.py functions).
 
-    If there is no global value associated with the variable, default is
-    returned.
+    If there is no global value associated with the variable, default is returned.
 
-    This function is useful for other functions in setting default values for
-    parameters.
+    This function is useful for other functions in setting default values for parameters.
 
     Example use:
 
@@ -1895,30 +1743,23 @@
 
     Example calls to my_func():
 
-    In the following example, the caller is explicitly asking to have quiet be
-    set to 1.
+    In the following example, the caller is explicitly asking to have quiet be set to 1.
 
     my_func(quiet=1)
 
-    In the following example, quiet will be set to the global value of quiet,
-    if defined, or to 0 (the default).
+    In the following example, quiet will be set to the global value of quiet, if defined, or to 0 (the
+    default).
 
     my_func()
 
     Description of argument(s):
-    var_value                       The value to be returned (if not equal to
-                                    None).
-    default                         The value that is returned if var_value is
-                                    None and there is no corresponding global
-                                    value defined.
-    var_name                        The name of the variable whose value is to
-                                    be returned.  Under most circumstances,
-                                    this value need not be provided.  This
-                                    function can figure out the name of the
-                                    variable passed as var_value.  One
-                                    exception to this would be if this
-                                    function is called directly from a .robot
-                                    file.
+    var_value                       The value to be returned (if not equal to None).
+    default                         The value that is returned if var_value is None and there is no
+                                    corresponding global value defined.
+    var_name                        The name of the variable whose value is to be returned.  Under most
+                                    circumstances, this value need not be provided.  This function can figure
+                                    out the name of the variable passed as var_value.  One exception to this
+                                    would be if this function is called directly from a .robot file.
     """
 
     if var_value is not None:
@@ -1940,9 +1781,8 @@
                   default="",
                   init_stack_ix=2):
     r"""
-    Starting with the caller's stack level, search upward in the call stack
-    for a variable named var_name and return its value.  If the variable
-    cannot be found in the stack, attempt to get the global value.  If the
+    Starting with the caller's stack level, search upward in the call stack for a variable named var_name and
+    return its value.  If the variable cannot be found in the stack, attempt to get the global value.  If the
     variable still cannot be found, return default.
 
     Example code:
@@ -1954,20 +1794,15 @@
         my_var1 = 11
         func12()
 
-    In this example, get_stack_var will find the value of my_var1 in func11's
-    stack and will therefore return the value 11.  Therefore, my_loc_var1
-    would get set to 11.
+    In this example, get_stack_var will find the value of my_var1 in func11's stack and will therefore return
+    the value 11.  Therefore, my_loc_var1 would get set to 11.
 
     Description of argument(s):
-    var_name                        The name of the variable to be searched
-                                    for.
-    default                         The value to return if the the variable
-                                    cannot be found.
-    init_stack_ix                   The initial stack index from which to
-                                    begin the search.  0 would be the index of
-                                    this func1tion ("get_stack_var"), 1 would
-                                    be the index of the function calling this
-                                    function, etc.
+    var_name                        The name of the variable to be searched for.
+    default                         The value to return if the the variable cannot be found.
+    init_stack_ix                   The initial stack index from which to begin the search.  0 would be the
+                                    index of this func1tion ("get_stack_var"), 1 would be the index of the
+                                    function calling this function, etc.
     """
 
     work_around_inspect_stack_cwd_failure()
@@ -1977,8 +1812,8 @@
                  if var_name in frame[0].f_locals), default)
 
 
-# hidden_text is a list of passwords which are to be replaced with asterisks
-# by print functions defined in this module.
+# hidden_text is a list of passwords which are to be replaced with asterisks by print functions defined in
+# this module.
 hidden_text = []
 # password_regex is created based on the contents of hidden_text.
 password_regex = ""
@@ -1986,15 +1821,14 @@
 
 def register_passwords(*args):
     r"""
-    Register one or more passwords which are to be hidden in output produced
-    by the print functions in this module.
+    Register one or more passwords which are to be hidden in output produced by the print functions in this
+    module.
 
     Note:  Blank password values are NOT registered.  They are simply ignored.
 
     Description of argument(s):
-    args                            One or more password values.  If a given
-                                    password value is already registered, this
-                                    function will simply do nothing.
+    args                            One or more password values.  If a given password value is already
+                                    registered, this function will simply do nothing.
     """
 
     global hidden_text
@@ -2008,21 +1842,18 @@
 
         # Place the password into the hidden_text list.
         hidden_text.append(password)
-        # Create a corresponding password regular expression.  Escape regex
-        # special characters too.
+        # Create a corresponding password regular expression.  Escape regex special characters too.
         password_regex = '(' +\
             '|'.join([re.escape(x) for x in hidden_text]) + ')'
 
 
 def replace_passwords(buffer):
     r"""
-    Return the buffer but with all registered passwords replaced by a string
-    of asterisks.
+    Return the buffer but with all registered passwords replaced by a string of asterisks.
 
 
     Description of argument(s):
-    buffer                          The string to be returned but with
-                                    passwords replaced.
+    buffer                          The string to be returned but with passwords replaced.
     """
 
     global password_regex
@@ -2042,36 +1873,28 @@
                                replace_dict,
                                func_prefix=""):
     r"""
-    Generate code for print wrapper functions and return the generated code as
-    a string.
+    Generate code for print wrapper functions and return the generated code as a string.
 
-    To illustrate, suppose there is a "print_foo_bar" function in the
-    func_names list.
+    To illustrate, suppose there is a "print_foo_bar" function in the func_names list.
     This function will...
     - Expect that there is an sprint_foo_bar function already in existence.
-    - Create a print_foo_bar function which calls sprint_foo_bar and prints
-      the result.
-    - Create a qprint_foo_bar function which calls upon sprint_foo_bar only if
-      global value quiet is 0.
-    - Create a dprint_foo_bar function which calls upon sprint_foo_bar only if
-      global value debug is 1.
+    - Create a print_foo_bar function which calls sprint_foo_bar and prints the result.
+    - Create a qprint_foo_bar function which calls upon sprint_foo_bar only if global value quiet is 0.
+    - Create a dprint_foo_bar function which calls upon sprint_foo_bar only if global value debug is 1.
 
-    Also, code will be generated to define aliases for each function as well.
-    Each alias will be created by replacing "print_" in the function name with
-    "p"  For example, the alias for print_foo_bar will be pfoo_bar.
+    Also, code will be generated to define aliases for each function as well.  Each alias will be created by
+    replacing "print_" in the function name with "p"  For example, the alias for print_foo_bar will be
+    pfoo_bar.
 
     Description of argument(s):
-    func_names                      A list of functions for which print
-                                    wrapper function code is to be generated.
-    stderr_func_names               A list of functions whose generated code
-                                    should print to stderr rather than to
-                                    stdout.
-    replace_dict                    Please see the create_func_def_string
-                                    function in wrap_utils.py for details on
-                                    this parameter.  This parameter will be
-                                    passed directly to create_func_def_string.
-    func_prefix                     Prefix to be pre-pended to the generated
-                                    function name.
+    func_names                      A list of functions for which print wrapper function code is to be
+                                    generated.
+    stderr_func_names               A list of functions whose generated code should print to stderr rather
+                                    than to stdout.
+    replace_dict                    Please see the create_func_def_string function in wrap_utils.py for
+                                    details on this parameter.  This parameter will be passed directly to
+                                    create_func_def_string.
+    func_prefix                     Prefix to be pre-pended to the generated function name.
     """
 
     buffer = ""
@@ -2086,8 +1909,7 @@
         q_func_name = "q" + func_name
         d_func_name = "d" + func_name
 
-        # We don't want to try to redefine the "print" function, thus the
-        # following if statement.
+        # We don't want to try to redefine the "print" function, thus the following if statement.
         if func_name != "print":
             func_def = create_func_def_string(s_func_name,
                                               func_prefix + func_name,
@@ -2124,29 +1946,24 @@
     return buffer
 
 
-# In the following section of code, we will dynamically create print versions
-# for each of the sprint functions defined above.  So, for example, where we
-# have an sprint_time() function defined above that returns the time to the
-# caller in a string, we will create a corresponding print_time() function
-# that will print that string directly to stdout.
+# In the following section of code, we will dynamically create print versions for each of the sprint
+# functions defined above.  So, for example, where we have an sprint_time() function defined above that
+# returns the time to the caller in a string, we will create a corresponding print_time() function that will
+# print that string directly to stdout.
 
-# It can be complicated to follow what's being created below.  Here is an
-# example of the print_time() function that will be created:
+# It can be complicated to follow what's being created below.  Here is an example of the print_time()
+# function that will be created:
 
 # def print_time(buffer=''):
 #     gp_print(replace_passwords(sprint_time(buffer=buffer)), stream='stdout')
 
-# For each print function defined below, there will also be a qprint, a
-# dprint and an lprint version defined (e.g. qprint_time, dprint_time,
-# lprint_time).
+# For each print function defined below, there will also be a qprint, a dprint and an lprint version defined
+# (e.g. qprint_time, dprint_time, lprint_time).
 
-# The q version of each print function will only print if the quiet variable
-# is 0.
-# The d version of each print function will only print if the debug variable
-# is 1.
-# The l version of each print function will print the contents as log data.
-# For conventional programs, this means use of the logging module.  For robot
-# programs it means use of the BuiltIn().log() function.
+# The q version of each print function will only print if the quiet variable is 0.
+# The d version of each print function will only print if the debug variable is 1.
+# The l version of each print function will print the contents as log data.  For conventional programs, this
+# means use of the logging module.  For robot programs it means use of the BuiltIn().log() function.
 
 # Templates for the various print wrapper functions.
 print_func_template = \
@@ -2181,16 +1998,14 @@
 
 gp_debug_print("robot_env: " + str(robot_env) + "\n")
 
-# func_names contains a list of all print functions which should be created
-# from their sprint counterparts.
+# func_names contains a list of all print functions which should be created from their sprint counterparts.
 func_names = ['print_time', 'print_timen', 'print_error', 'print_varx',
               'print_var', 'print_vars', 'print_dashes', 'indent',
               'print_call_stack', 'print_func_name', 'print_executing',
               'print_pgm_header', 'print_issuing', 'print_pgm_footer',
               'print_error_report', 'print', 'printn']
 
-# stderr_func_names is a list of functions whose output should go to stderr
-# rather than stdout.
+# stderr_func_names is a list of functions whose output should go to stderr rather than stdout.
 stderr_func_names = ['print_error', 'print_error_report']
 
 func_defs = create_print_wrapper_funcs(func_names, stderr_func_names,