Change mask in RandomHorizontalFlip Transform

I’m learning object detection from this tutorial. in a part of that, The tutorial uses a transform to RandomHorizontalFlip for data augmentation.
It uses this code:

def get_transform(train):
    transforms = []
    if train:
    return T.Compose(transforms)

img, target = self.transforms(img, target)

I got an error because the transform just gets an image but the tutorial pass two-argument (img, target)
I remove the target and pass only img. It seems OK.
But the dataset is for object detection and every image needs a mask. so if I use RandomHorizontalFlip then I need to change the mask. Right?
How can I solve the problem?

Pl. see if this answer helps with your question:

I hope this tutorial will be corrected.