docs: def valid_input(val):
          """ Ensure the input the user gave is of a valid format """
          # looks for 3 nums followed by a dot 3 times and then ending with
          # 3 nums, can be proceeded by any number of spaces
          ip_value = re.compile(r'(\d{1,3}\.){3}\d{1,3}$')
          # looks for only numbers and commas (because priorities can have commas
          # between them), can be proceeded by any number of spaces
          all_num = re.compile(r'(\d,?\ *)+$')
          sections_comments = re.compile(r"""
          \ *\#.*             # comments (any number of whitespace, then #
                              # followed by anything)
  
          | \[[\w-]+\]$       # section headers (any combination of chars, nums,
                              # underscores, and dashes between brackets)
          """, re.VERBOSE)
          # can't can be a comment on option side and value side can't have
          # [, ], {, or } otherwise it is turned over to literal_eval for
          # checkout
          options_values = re.compile(r'[^# ]+\ *=[^[\]{}]*$')
          line_num = 0
          warning_str = ''
          error_str = ''
          trimmed_val = []
          for entry in val.split('\n'):
              line_num += 1
              # get rid of any extraneous commas at the end of a dict and remove
              # extra whitespace from input
              trimmed_val.append(re.sub(r',\ *}', '}', entry).strip())
              # empty line
              if entry.strip() == '':
                  continue
              # look at regular (non dictionary or list) option-value pairs
              if options_values.match(entry):
                  value = entry.split('=', 1)[1]
                  # deal with potentially more equals signs
                  for val in value.split('='):
                      val = val.strip()
                      # empty val means malformed equals signs
                      if val == '':
                          error_str += '-You have a misplaced equals sign on' \
                              ' line ' + str(line_num) + '\n'
                      # starts with a num; look for bad ip input or warn user
                      # about having extraneous characters in number input
                      if re.match('\ *\d', val):
                          # bad ip syntax
                          if val.find('.') >= 0 and not ip_value.match(val):
                              error_str += '-You have an incorrectly' \
                                  ' formatted ip address (bad syntax) at' \
                                  ' line ' + str(line_num) + '\n'
                          # possibly malformed numbers
                          elif val.find('.') < 0 and not all_num.match(val):
                              warning_str += '-Line starting with a number has' \
                                  ' characters mixed in at line ' + \
                                  str(line_num) + '\n'
                          # bad ip values
                          elif val.find('.') >= 0:
                              for num in val.strip().split('.'):
                                  num = int(num)
                                  if num > 255 or num < 0:
                                      error_str += '-You have an incorrectly' \
                                          ' formatted ip address (values' \
                                          ' exceeding 255 or below 0) at' \
                                          ' line ' + str(line_num) + '\n'
                      # ensure no lines end with a comma (most likely extraneous
                      # commas from groups or priorities)
                      if re.search(',$', val):
                          error_str += '-You have an incorrect comma at the' \
                              ' end of line ' + str(line_num) + '\n'
              # see if input is a header or comment, otherwise try to
              # literal_eval it to ensure correct structure
              elif not sections_comments.match(entry):
                  lit_val = ''
                  try:
                      opt_val = entry.split('=', 1)
                      if opt_val[0].strip() == '':
                          error_str += '-You have nothing preceeding an' \
                              ' equals sign at line ' + str(line_num) + '\n'
                      else:
                          lit_val = opt_val[1].strip()
                  except IndexError:
                      lit_val = ''
                      error_str += '-You have an incorrectly formatted' \
                          ' section header at line ' + str(line_num) + '\n'
                  if lit_val:
                      try:
                          ast.literal_eval(lit_val)
                      except SyntaxError:
                          error_str += '-You have an incorrectly formatted' \
                              ' list/dictionary at line ' + str(line_num) + \
                              '\n'
  
          if error_str:
              npyscreen.notify_confirm('You have the following error(s) and'
                                       " can't proceed until they are fixed:" +
                                       '\n' + '-'*50 + '\n' + error_str,
                                       title='Error in input')
              return (False, '')
          elif warning_str:
              res = npyscreen.notify_yes_no('You have may have some error(s)'
                                            ' that you want to check before'
                                            ' proceeding:' + '\n' + '-'*50 +
                                            '\n' + warning_str + '\n' + '-'*50 +
                                            '\n' + 'Do you want to continue?',
                                            title='Double check')
              return (res, '\n'.join(trimmed_val))
          return (True, '\n'.join(trimmed_val))