code: def __detect_cl_tool(env, chainkey, cdict, cpriority=None):
      
      if env.get(chainkey,'') == '':
          clpath = ''
  
          if cpriority is None:
              cpriority = cdict.keys()
          for cltool in cpriority:
              if __debug_tool_location:
                  print("DocBook: Looking for %s"%cltool)
              clpath = env.WhereIs(cltool)
              if clpath:
                  if __debug_tool_location:
                      print("DocBook: Found:%s"%cltool)
                  env[chainkey] = clpath
                  if not env[chainkey + 'COM']:
                      env[chainkey + 'COM'] = cdict[cltool]
                  break
docs: Helper function, picks a command line tool from the list
      and initializes its environment variables.