code: def generate_key_value_sequences(entry, default_value):
      
      no_one_yielded = True
      for value in entry.split(','):
          value = value.strip()
          if not value:
              continue
          full_match = KEY_VALUES_REGEX.match(value)
          if full_match is None:
              raise KeyValueSyntaxError("%r is an invalid key(-values) pattern" % value)
          key = full_match.group(1)
          tmp = {'KEY': key}
          values = full_match.group(2)
          if values:  # there is, at least, one value provided
              for idx, value_match in enumerate(VALUE_REGEX.finditer(values), 1):
                  tmp['VALUE%s' % idx] = value_match.group(1)
          else:  # no value provided for this key, use the default provided:
              tmp['VALUE1'] = default_value
          tmp['VALUE'] = tmp['VALUE1']  # alias from VALUE -> VALUE1
          for subkey in expand_ranges(key):
              current = tmp.copy()
              current['KEY'] = subkey
              yield current
              no_one_yielded = False
      if no_one_yielded:
          raise KeyValueSyntaxError('At least one key must be present')
docs: Parse a key value config entry (used in duplicate foreach)
  
      If we have a key that look like [X-Y] we will expand it into Y-X+1 keys
  
      :param str entry: The config line to be parsed.
      :param str default_value: The default value to be used when none is available.
      :return: a generator yielding dicts with 'KEY' & 'VALUE' & 'VALUE1' keys,
               with eventual others 'VALUEx' (x 1 -> N) keys.
  
      >>> rsp = list(generate_key_value_sequences("var$(/var)$,root $(/)$"))
      >>> import pprint
      >>> pprint.pprint(rsp)
      [{'KEY': 'var', 'VALUE': '/var', 'VALUE1': '/var'},
       {'KEY': 'root', 'VALUE': '/', 'VALUE1': '/'}]