docs: def getHostsFromFile(filename):
      """Parse a file to return a list of hosts."""
      valid_hostname = r"^[^ /\t=\n]+"
      workers = r"\d+"
      hostname_re = re.compile(valid_hostname)
      worker_re = re.compile(workers)
      hosts = []
      with open(filename) as f:
          for line in f:
              # check to see if it is a SLURM grouping instead of a
              # regular list of hosts
              if re.search('[\[\]]', line):
                  hosts = hosts + parseSLURM(line.strip())
              else:
                  host = hostname_re.search(line.strip())
                  if host:
                      hostname = host.group()
                      n = worker_re.search(line[host.end():])
                      if n:
                          n = n.group()
                      else:
                          # Automatically assign based on CPU count
                          n = 0
                      hosts.append((hostname, int(n)))
      return hosts