docs: def match_nth(self, el, nth):
          """Match `nth` elements."""
  
          matched = True
  
          for n in nth:
              matched = False
              if n.selectors and not self.match_selectors(el, n.selectors):
                  break
              parent = self.get_parent(el)
              if parent is None:
                  parent = self.create_fake_parent(el)
              last = n.last
              last_index = len(parent) - 1
              index = last_index if last else 0
              relative_index = 0
              a = n.a
              b = n.b
              var = n.n
              count = 0
              count_incr = 1
              factor = -1 if last else 1
              idx = last_idx = a * count + b if var else a
  
              # We can only adjust bounds within a variable index
              if var:
                  # Abort if our nth index is out of bounds and only getting further out of bounds as we increment.
                  # Otherwise, increment to try to get in bounds.
                  adjust = None
                  while idx < 1 or idx > last_index:
                      if idx < 0:
                          diff_low = 0 - idx
                          if adjust is not None and adjust == 1:
                              break
                          adjust = -1
                          count += count_incr
                          idx = last_idx = a * count + b if var else a
                          diff = 0 - idx
                          if diff >= diff_low:
                              break
                      else:
                          diff_high = idx - last_index
                          if adjust is not None and adjust == -1:
                              break
                          adjust = 1
                          count += count_incr
                          idx = last_idx = a * count + b if var else a
                          diff = idx - last_index
                          if diff >= diff_high:
                              break
                          diff_high = diff
  
                  # If a < 0, our count is working backwards, so floor the index by increasing the count.
                  # Find the count that yields the lowest, in bound value and use that.
                  # Lastly reverse count increment so that we'll increase our index.
                  lowest = count
                  if a < 0:
                      while idx >= 1:
                          lowest = count
                          count += count_incr
                          idx = last_idx = a * count + b if var else a
                      count_incr = -1
                  count = lowest
                  idx = last_idx = a * count + b if var else a
  
              # Evaluate elements while our calculated nth index is still in range
              while 1 <= idx <= last_index + 1:
                  child = None
                  # Evaluate while our child index is still in range.
                  for child in self.get_children(parent, start=index, reverse=factor < 0, tags=False):
                      index += factor
                      if not self.is_tag(child):
                          continue
                      # Handle `of S` in `nth-child`
                      if n.selectors and not self.match_selectors(child, n.selectors):
                          continue
                      # Handle `of-type`
                      if n.of_type and not self.match_nth_tag_type(el, child):
                          continue
                      relative_index += 1
                      if relative_index == idx:
                          if child is el:
                              matched = True
                          else:
                              break
                      if child is el:
                          break
                  if child is el:
                      break
                  last_idx = idx
                  count += count_incr
                  if count < 0:
                      # Count is counting down and has now ventured into invalid territory.
                      break
                  idx = a * count + b if var else a
                  if last_idx == idx:
                      break
              if not matched:
                  break
          return matched