class_docstr: See documentation here
  
  https://wiki.yandex-team.ru/yatool/test/#python-acquire-ports
class_docstr_tok: ["See","documentation","here","https",":","\/\/wiki.yandex-team.ru\/yatool\/test\/","#","python-acquire-ports"]
code: def _count_valid_ports(self):
      res = 0
      for left, right in self._valid_range:
          res += right - left
      assert res, (
          "There are no available valid ports",
          self._valid_range,
      )
      return res
  
imports: import os
  import errno
  import socket
  import random
  import logging
  import platform
  import threading
  import six
label_desc: Use image node_id 12 for calling the PortManager obj's underlying member method code with example usage: obj._count_valid_ports() and returns: res