S3 L2 LST masking and subsetting

I want to subset and reproject S3 L2 SLSTR images, and I wrote a python script. Part of the code is below. Before subsetting I want to apply the mask “not cloud_in_visible && not cloud_in_thin_cirrus && LST_uncertainty < 0.182”.
subset_op = snappy.jpy.get_type(‘org.esa.snap.core.gpf.common.SubsetOp’)()
target_op = subset_op.getTargetProduct()

reproject_op = snappy.jpy.get_type("org.esa.snap.core.gpf.common.reproject.ReprojectionOp")()
reproject_op.setParameter("resampling", "Nearest")
reproject_p = reproject_op.getTargetProduct()
ProductIO.writeProduct(reproject_p, out_file, "GeoTIFF-BigTIFF")

Can someone post an example for masking the pixels from a product before subsetting and reprojection?
I found the code for applying the mask on a band, but at the end I don’t know how to subset and reproject the band.
# band = target_op.getBand(in_band)
# band.setValidPixelExpression(‘not cloud_in_visible && not cloud_in_thin_cirrus && LST_uncertainty < 0.182’)
# band.getValidMaskImage()
Thank you,