Simplify logic in DistanceMatrix.__contains__

Thanks @gregcaporaso