code: def get_free_tcp_port(self, project, port_range_start=None, port_range_end=None):
          
  
          # use the default range is not specific one is given
          if port_range_start is None and port_range_end is None:
              port_range_start = self._console_port_range[0]
              port_range_end = self._console_port_range[1]
  
          port = self.find_unused_port(port_range_start,
                                       port_range_end,
                                       host=self._console_host,
                                       socket_type="TCP",
                                       ignore_ports=self._used_tcp_ports)
  
          self._used_tcp_ports.add(port)
          project.record_tcp_port(port)
          log.debug("TCP port {} has been allocated".format(port))
          return port
docs: Get an available TCP port and reserve it
  
          :param project: Project instance