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"]
docstr: Gets one free port for use in both TCP and UDP protocols
docstr_tok: ["Gets","one","free","port","for","use","in","both","TCP","and","UDP","protocols"]
code: def get_tcp_and_udp_port(self, port=0):
      """
      Gets one free port for use in both TCP and UDP protocols
      """
      if port and self._no_random_ports():
          return port
  
      retries = 20
      while retries > 0:
          retries -= 1
  
          result_port = self.get_tcp_port()
          if not self.is_port_free(result_port, socket.SOCK_DGRAM):
              self.release_port(result_port)
          # Don't try to _capture_port(), it's already captured in the get_tcp_port()
          return result_port
      raise Exception("Failed to find port")
  
imports: import os
  import errno
  import socket
  import random
  import logging
  import platform
  import threading
  import six
label_desc: Use image node_id 7 for calling the PortManager obj's underlying member method code with example usage: obj.get_tcp_and_udp_port(port) and returns: port, result_port