code: def getHostsFromPBS():
      
      # See above comment about Counter
      with open(os.environ["PBS_NODEFILE"], 'r') as hosts:
          hostlist = groupTogether(hosts.read().split())
          retVal = []
          for key, group in groupby(hostlist):
              retVal.append((key, len(list(group))))
          return retVal
docs: Return a host list in a PBS environment