code: def validate_port_range(cls, port_range):
          
          ports = port_range.split("-")
          if all(ports) and int(ports[-1]) <= 65535 and not len(ports) != 2:
              return True
          raise ScannerException("Invalid port range {}".format(port_range))
docs: Validate port range for Nmap scan