def METHOD_NAME(self, expected_size, check_node3=True):
    for i in range(self.num_nodes if check_node3 else self.num_nodes - 1):
        mempool = self.nodes[i].getrawmempool()
        if len(mempool) != expected_size:
            # print all nodes' mempools before failing
            for i in range(self.num_nodes):
                print("Mempool for node {}: {}".format(i, mempool))
            fail("Fail: Mempool for node {}: size={}, expected={}".format(i, len(mempool), expected_size))