I have a weighted sample, for which I wish to calculate quantiles.1
Ideally, where the weights are equal (whether = 1 or otherwise), the results would be consistent with those of
scipy.stats.scoreatpercentile() and R's
One simple approach would be to "multiply out" the sample using the weights given. That effectively gives a locally "flat" ecdf in the areas of weight > 1, which intuitively seems like the wrong approach when the sample is actually a sub-sampling. In particular, it means that a sample with weights all equal to 1 has different quantiles than one with weights all equal to 2, or 3. (Note, however, that the paper referenced in  does appear to use this approach.)
http://en.wikipedia.org/wiki/Percentile#Weighted_percentile gives an alternative formulation for weighted percentile. Its not clear in this formulation whether adjacent samples with identical values should first be combined and their weights summed, and in any case its results do not appear to be consistent with R's default type 7
quantile() in the unweighted/equally weighted case. The wikipedia page on quantiles doesn't mention the weighted case at all.
Is there a weighted generalisation of R's "type 7" quantile function?
[using Python, but just looking for an algorithm, really, so any language will do]
 Weights are integers; the weights are those of the buffers which are combined in the "collapse" and "output" operations as described in http://infolab.stanford.edu/~manku/papers/98sigmod-quantiles.pdf. Essentially the weighted sample is a sub-sampling of the full unweighted sample, with each element x(i) in the sub-sample representing weight(i) elements in the full sample.