class_docstr: Matches requests with paths specified by ``path_pattern`` regex.
class_docstr_tok: ["Matches","requests","with","paths","specified","by","``","path_pattern","``","regex","."]
docstr: Returns a tuple (reverse string, group count) for a url.
  
  For example: Given the url pattern /([0-9]{4})/([a-z-]+)/, this method
  would return ('/%s/%s/', 2).
docstr_tok: ["Returns","a","tuple","(","reverse","string",",","group","count",")","for","a","url",".","For","example",":","Given","the","url","pattern","\/","(","[","0-9","]","{","4","}",")","\/","(","[","a-z-","]","+",")","\/",",","this","method","would","return","(","'\/","%","s\/","%","s\/","'",",","2",")","."]
code: def _find_groups(self):
      """Returns a tuple (reverse string, group count) for a url.
  
      For example: Given the url pattern /([0-9]{4})/([a-z-]+)/, this method
      would return ('/%s/%s/', 2).
      """
      pattern = self.regex.pattern
      if pattern.startswith("^"):
          pattern = pattern[1:]
      if pattern.endswith("$"):
          pattern = pattern[:-1]
  
      if self.regex.groups != pattern.count("("):
          # The pattern is too complicated for our simplistic matching,
          # so we can't support reversing it.
          return None, None
  
      pieces = []
      for fragment in pattern.split("("):
          if ")" in fragment:
              paren_loc = fragment.index(")")
              if paren_loc >= 0:
                  pieces.append("%s" + fragment[paren_loc + 1 :])
          else:
              try:
                  unescaped_fragment = re_unescape(fragment)
              except ValueError as exc:
                  # If we can't unescape part of it, we can't
                  # reverse this url.
                  return (None, None)
              pieces.append(unescaped_fragment)
  
      return "".join(pieces), self.regex.groups
  
imports: from __future__ import absolute_import, division, print_function
  import re
  from functools import partial
  from tornado import httputil
  from tornado.httpserver import _CallableAdapter
  from tornado.escape import url_escape, url_unescape, utf8
  from tornado.log import app_log
  from tornado.util import basestring_type, import_object, re_unescape, unicode_type
label_desc: Use image node_id 4 for calling the PathMatches obj's underlying member method code with example usage: obj._find_groups() and returns: str,  self, None,  None, None,  None