def match(self, path_pattern):
cf = self._flavour.casefold<EOL>path_pattern = cf(path_pattern)<EOL>drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))<EOL>if not pat_parts:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if drv and drv != cf(self._drv):<EOL><INDENT>return False<EOL><DEDENT>if root and root != cf(self._root):<EOL><INDENT>return False<EOL><DEDENT>parts = self._cparts<EOL>if drv or root:<EOL><INDENT>if len(pat_parts) != len(parts):<EOL><INDENT>return False<EOL><DEDENT>pat_parts = pat_parts[<NUM_LIT:1>:]<EOL><DEDENT>elif len(pat_parts) > len(parts):<EOL><INDENT>return False<EOL><DEDENT>for part, pat in zip(reversed(parts), reversed(pat_parts)):<EOL><INDENT>if not fnmatch.fnmatchcase(part, pat):<EOL><INDENT>return False<EOL><DEDENT><DEDENT>return True<EOL>
Return True if this path matches the given pattern.