code: def refresh(self, only_closed=False):
          
          if only_closed:
              opened = filter(self.__check_port, self.__closed)
              self.__closed = self.__closed.difference(opened)
              self.__ports = self.__ports.union(opened)
          else:
              ports = self.__closed.union(self.__ports)
              self.__ports = set(filter(self.__check_port, ports))
              self.__closed = ports.difference(self.__ports)
docs: refresh ports status
          Args:
            only_closed - check status only for closed ports