<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_patterns(self, pattern):
 """Parse patterns."""


        self.pattern = []
        self.npatterns = None
        npattern = []
        for p in pattern:
            if _wcparse.is_negative(p, self.flags):
                # Treat the inverse pattern as a normal pattern if it matches, we will exclude.
                # This is faster as compiled patterns usually compare the include patterns first,
                # and then the exclude, but glob will already know it wants to include the file.
                npattern.append(p[1:])
            else:
                self.pattern.extend(
                    [_wcparse.WcPathSplit(x, self.flags).split() for x in _wcparse.expand_braces(p, self.flags)]
                )
        if npattern:
            self.npatterns = _wcparse.compile(npattern, self.flags ^ (_wcparse.NEGATE | _wcparse.REALPATH))
        if not self.pattern and self.npatterns is not None:
            self.pattern.append(_wcparse.WcPathSplit((b'**' if self.is_bytes else '**'), self.flags).split())