def _FindTag(template, open_marker, close_marker):
  """Finds a single tag.

  Args:
    template: the template to search.
    open_marker: the start of the tag (e.g., '{{').
    close_marker: the end of the tag (e.g., '}}').

  Returns:
    (tag, pos1, pos2) where the tag has the open and close markers
    stripped off and pos1 is the start of the tag and pos2 is the end of
    the tag. Returns (None, None, None) if there is no tag found.
  """
  open_pos = template.find(open_marker)
  close_pos = template.find(close_marker, open_pos)
  if open_pos < 0 or close_pos < 0 or open_pos > close_pos:
    return (None, None, None)
  return (template[open_pos + len(open_marker):close_pos],
          open_pos,
          close_pos + len(close_marker))