code: def port(self, check=False):
          
          if not self.__ports:  # refresh ports if sequence is empty
              self.refresh()
  
          try:
              port = self.__ports.pop()
              if check:
                  while not self.__check_port(port):
                      self.release_port(port)
                      port = self.__ports.pop()
          except (IndexError, KeyError):
              raise IndexError("Could not find a free port,\nclosed ports: {closed}".format(closed=self.__closed))
          self.__closed.add(port)
          return port
docs: return next opened port
          Args:
            check - check is port realy free