def _parse(self, object_file, object_types, object_select):

        def unescape(match):
            esc = match.group(1)
            if esc == r'\\':
                return '\\'
            elif esc == r'\n':
                return '\n'
            elif esc == r'\_':
                return '|'
            else:
                assert 0

        for type_ in object_types:
            self._objects[type_] = []

        splitter = None
        object_data = None
        object_type = None
        for line in object_file:
            line = line.strip()
            if object_data is None:
                if line.startswith("define") and line.endswith('{'):
                    type_ = line[7:-2]
                    splitter = None
                elif line.endswith('status {'):
                    splitter = '='
                    type_ = line[:-8]
                elif line.endswith(' {'):
                    splitter = '='
                    type_ = line[:-2]
                else:
                    continue

                assert type_
                if object_types and type_ not in object_types:
                    continue
                object_data = {}
                object_type = type_
            elif line == '}':
                if self._objects not in object_type:
                    self._objects[object_type] = [object_data]
                else:
                    self._objects[object_type].append(object_data)
                object_data = None
                object_type = None
            else:
                split = line.split(splitter, 1)
                try:
                    key, value = split
                except ValueError:
                    key = split[0]
                    value = ""

                if object_select and key in object_select:
                    selector = object_select[key]
                    if isinstance(selector, basestring):
                        if value != selector:
                            object_data = None
                            object_type = None
                            continue
                    else:
                        if value not in selector:
                            object_data = None
                            object_type = None
                            continue

                if '\\' in value:
                    value = self.UNESCAPE.sub(unescape, value)
                object_data[key] = value
dataset/ETHPy150Open marineam/nagcat/python/nagcat/_object_parser_py.py/ObjectParser._parse/swapped operands of `not in`