def _flip_keypoints(keypoints, width, hflip_inds):
    """ Variation of `references.transforms._flip_coco_person_keypoints` with additional
    hflip_inds. """
    flipped_keypoints = keypoints[:, hflip_inds]
    flipped_keypoints[..., 0] = width - flipped_keypoints[..., 0]
    # Maintain COCO convention that if visibility == 0, then x, y = 0
    inds = flipped_keypoints[..., 2] == 0
    flipped_keypoints[inds] = 0
    return flipped_keypoints