class_docstr: Helper to figure out/use versions of the externals (modules, cmdline tools, etc).
  
  To avoid collision between names of python modules and command line tools,
  prepend names for command line tools with `cmd:`.
  
  It maintains a dictionary of `distuil.version.LooseVersion`s to make
  comparisons easy. Note that even if version string conform the StrictVersion
  "standard", LooseVersion will be used.  If version can't be deduced for the
  external, `UnknownVersion()` is assigned.  If external is not present (can't
  be imported, or custom check throws exception), None is returned without
  storing it, so later call will re-evaluate fully.
class_docstr_tok: ["Helper","to","figure","out\/use","versions","of","the","externals","(","modules",",","cmdline","tools",",","etc",")",".","To","avoid","collision","between","names","of","python","modules","and","command","line","tools",",","prepend","names","for","command","line","tools","with","`","cmd",":","`",".","It","maintains","a","dictionary","of","`","distuil.version.LooseVersion","`","s","to","make","comparisons","easy",".","Note","that","even","if","version","string","conform","the","StrictVersion","''","standard","''",",","LooseVersion","will","be","used",".","If","version","ca","n't","be","deduced","for","the","external",",","`","UnknownVersion","(",")","`","is","assigned",".","If","external","is","not","present","(","can't","be","imported",",","or","custom","check","throws","exception",")",",","None","is","returned","without","storing","it",",","so","later","call","will","re-evaluate","fully","."]
docstr: Add a version checker
  
  This method allows third-party libraries to define additional checks.
  It will not add `name` if already exists.  If `name` exists and `func`
  is different - it will override with a new `func`.  Added entries will
  be included in the output of `dumps(query=True)`.
  
  Parameters
  ----------
  name: str
    Name of the check (usually a name of the Python module, or an
    external command prefixed with "cmd:")
  func: callable, optional
    Function to be called to obtain version information. This should be
    defined when checking the version of something that is not a Python
    module or when this class's method for determining the version of a
    Python module isn't sufficient.
docstr_tok: ["Add","a","version","checker","This","method","allows","third-party","libraries","to","define","additional","checks",".","It","will","not","add","`","name","`","if","already","exists",".","If","`","name","`","exists","and","`","func","`","is","different","-","it","will","override","with","a","new","`","func","`",".","Added","entries","will","be","included","in","the","output","of","`","dumps","(","query=True",")","`",".","Parameters","--","--","--","--","--","name",":","str","Name","of","the","check","(","usually","a","name","of","the","Python","module",",","or","an","external","command","prefixed","with","``","cmd",":","''",")","func",":","callable",",","optional","Function","to","be","called","to","obtain","version","information",".","This","should","be","defined","when","checking","the","version","of","something","that","is","not","a","Python","module","or","when","this","class","'s","method","for","determining","the","version","of","a","Python","module","is","n't","sufficient","."]
code: def add(self, name, func=None):
      """Add a version checker
  
      This method allows third-party libraries to define additional checks.
      It will not add `name` if already exists.  If `name` exists and `func`
      is different - it will override with a new `func`.  Added entries will
      be included in the output of `dumps(query=True)`.
  
      Parameters
      ----------
      name: str
        Name of the check (usually a name of the Python module, or an
        external command prefixed with "cmd:")
      func: callable, optional
        Function to be called to obtain version information. This should be
        defined when checking the version of something that is not a Python
        module or when this class's method for determining the version of a
        Python module isn't sufficient.
      """
      if func:
          func_existing = self.CUSTOM.get(name, None)
          was_known = False
          if func_existing and func_existing is not func:
              lgr.debug(
                  "Adding a new custom version checker %s for %s, "
                  "old one: %s",
                  func,
                  name,
                  func_existing,
              )
              was_known = name in self._versions
          self.CUSTOM[name] = func
          if was_known:
              # pop and query it again right away to possibly replace with a new value
              self._versions.pop(name)
              _ = self[name]
      elif name not in self.INTERESTING:
          self.INTERESTING.append(name)
  
imports: import os.path
  import re
  import sys
  from itertools import chain
  from os import linesep
  from looseversion import LooseVersion
  from datalad.config import get_git_version
  from datalad.log import lgr
  from .exceptions import CapturedException, CommandError
  from datalad.cmd import GitWitlessRunner, StdOutErrCapture, WitlessRunner
  from datalad.support.exceptions import MissingExternalDependency, OutdatedExternalDependency
label_desc: Use image node_id 6 for calling the ExternalVersions obj's underlying member method code with example usage: obj.add(name, func) without return types