class_docstr: ``NameCountMessenger`` is the implementation of :func:`pyro.contrib.autoname.name_count`
class_docstr_tok: ["``","NameCountMessenger","``","is","the","implementation","of",":","func",":","`","pyro.contrib.autoname.name_count","`"]
code: def _increment_name(self, name, label):
      while (name, label) in self._names:
          split_name = name.split("__")
          if "__" in name and split_name[-1].isdigit():
              counter = int(split_name[-1]) + 1
              name = "__".join(split_name[:-1] + [str(counter)])
          else:
              name = name + "__1"
      return name
  
imports: import functools
  from pyro.poutine.messenger import Messenger
  from pyro.poutine.runtime import effectful
label_desc: Use image node_id 2 for calling the NameCountMessenger obj's underlying member method code with example usage: obj._increment_name(name, label) and returns: name