docstr: Matplotlib with specific title will reset the title counter on every new iteration.
  Calling title twice each iteration will produce "title" and "title/1" for every iteration
  
  :param title: original matplotlib title
  :param last_iteration: the current "last_iteration"
  :return: new title to use (with counter attached if necessary)
docstr_tok: ["Matplotlib","with","specific","title","will","reset","the","title","counter","on","every","new","iteration",".","Calling","title","twice","each","iteration","will","produce","``","title","''","and","``","title\/1","''","for","every","iteration",":","param","title",":","original","matplotlib","title",":","param","last_iteration",":","the","current","``","last_iteration","''",":","return",":","new","title","to","use","(","with","counter","attached","if","necessary",")"]
code: def _enforce_unique_title_per_iteration(title, last_iteration):
      # type: (str, int) -> str
      """
      Matplotlib with specific title will reset the title counter on every new iteration.
      Calling title twice each iteration will produce "title" and "title/1" for every iteration
  
      :param title: original matplotlib title
      :param last_iteration: the current "last_iteration"
      :return: new title to use (with counter attached if necessary)
      """
      # check if we already encountered the title
      if title in PatchedMatplotlib._last_iteration_plot_titles:
          # if we have check the last iteration
          (
              title_last_iteration,
              title_counter,
          ) = PatchedMatplotlib._last_iteration_plot_titles[title]
          # if this is a new iteration start from the beginning
          if last_iteration == title_last_iteration:
              title_counter += 1
          else:  # if this is a new iteration start from the beginning
              title_last_iteration = last_iteration
              title_counter = 0
      else:
          # this is a new title
          title_last_iteration = last_iteration
          title_counter = 0
  
      base_title = title
      # if this is the zero counter to not add the counter to the title
      if title_counter != 0:
          title = base_title + "/%d" % title_counter
      # update back the title iteration counter
      PatchedMatplotlib._last_iteration_plot_titles[base_title] = (
          title_last_iteration,
          title_counter,
      )
  
      return title
  
imports: import sys
  import threading
  from copy import deepcopy
  from tempfile import mkstemp
  import six
  from six import BytesIO
  from .import_bind import PostImportHookPatching
  from ..config import running_remotely
  from ..debugging.log import LoggerRoot
  from ..utilities.resource_monitor import ResourceMonitor
label_desc: Use image node_id 14 for calling the PatchedMatplotlib obj's underlying member method code with example usage: obj._enforce_unique_title_per_iteration(title, last_iteration) and returns: title