docs: def _check_rotated_filename_candidates(self):
          """
          Check for various rotated logfile filename patterns and return the first
          match we find.
          """
          # savelog(8)
          candidate = "%s.0" % self.filename
          if (exists(candidate) and exists("%s.1.gz" % self.filename) and
              (stat(candidate).st_mtime > stat("%s.1.gz" % self.filename).st_mtime)):
              return candidate
  
          # logrotate(8)
          # with delaycompress
          candidate = "%s.1" % self.filename
          if exists(candidate):
              return candidate
  
          # without delaycompress
          candidate = "%s.1.gz" % self.filename
          if exists(candidate):
              return candidate
  
          rotated_filename_patterns = [
              # logrotate dateext rotation scheme - `dateformat -%Y%m%d` + with `delaycompress`
              "%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]",
              # logrotate dateext rotation scheme - `dateformat -%Y%m%d` + without `delaycompress`
              "%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].gz",
              # logrotate dateext rotation scheme - `dateformat -%Y%m%d-%s` + with `delaycompress`
              "%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]",
              # logrotate dateext rotation scheme - `dateformat -%Y%m%d-%s` + without `delaycompress`
              "%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].gz",
              # for TimedRotatingFileHandler
              "%s.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]",
          ]
          if self.log_patterns:
              rotated_filename_patterns.extend(self.log_patterns)
  
          # break into directory and filename components to support cases where the
          # the file is prepended as part of rotation
          file_dir, rel_filename = os.path.split(self.filename)
          for rotated_filename_pattern in rotated_filename_patterns:
              candidates = glob.glob(os.path.join(file_dir, rotated_filename_pattern % rel_filename))
              if candidates:
                  candidates.sort()
                  return candidates[-1]  # return most recent
  
          # no match
          return None