docs: def _parse_port_ranges(pool_str):
      """Given a 'N-P,X-Y' description of port ranges, return a set of ints."""
      ports = set()
      for range_str in pool_str.split(','):
          try:
              a, b = range_str.split('-', 1)
              start, end = int(a), int(b)
          except ValueError:
              log.error('Ignoring unparsable port range %r.', range_str)
              continue
          if start < 1 or end > 65535:
              log.error('Ignoring out of bounds port range %r.', range_str)
              continue
          ports.update(set(range(start, end + 1)))
      return ports