code: def parse(self, stream):
          
  
          items = OrderedDict()
          for i, line in enumerate(stream):
              line = line.strip()
              if not line or line[0] in ["#", ";", "["] or line.startswith("---"):
                  continue
              white_space = "\\s*"
              key = "(?P<key>[^:=;#\s]+?)"
              value = white_space+"[:=\s]"+white_space+"(?P<value>.+?)"
              comment = white_space+"(?P<comment>\\s[;#].*)?"
  
              key_only_match = re.match("^" + key + comment + "$", line)
              if key_only_match:
                  key = key_only_match.group("key")
                  items[key] = "true"
                  continue
  
              key_value_match = re.match("^"+key+value+comment+"$", line)
              if key_value_match:
                  key = key_value_match.group("key")
                  value = key_value_match.group("value")
  
                  if value.startswith("[") and value.endswith("]"):
                      # handle special case of lists
                      value = [elem.strip() for elem in value[1:-1].split(",")]
  
                  items[key] = value
                  continue
  
              raise ConfigFileParserException("Unexpected line %s in %s: %s" % (i,
                  getattr(stream, 'name', 'stream'), line))
          return items
docs: Parses the keys + values from a config file.