Sorry, but that's not the way to do it.

Rename the function to `_mask_border_keypoints` and return the mask itself:

    return (dist - 1 < keypoints[:, 0]) & (keypoints[:, 0] < width - dist + 1) & (dist - 1 < keypoints[:, 1]) & (keypoints[:, 1] < height - dist + 1)

The do the following in censure and brief:

    mask = _mask_border_keypoints(...)
    keypoints = keypoints[mask]
    scales = scales[mask]

    return keypoints, scales