  Aims. We present pyUPMASK, an unsupervised clustering method for stellar
clusters that builds upon the original UPMASK package. Its general approach
makes it plausible to be applied to analyses that deal with binary classes of
any kind, as long as the fundamental hypotheses are met. The code is written
entirely in Python and is made available through a public repository.
Methods.The core of the algorithm follows the method developed in UPMASK but
introducing several key enhancements. These enhancements not only make pyUPMASK
more general, they also improve its performance considerably. Results. We
thoroughly tested the performance of pyUPMASK on 600 synthetic clusters,
affected by varying degrees of contamination by field stars. To assess the
performance we employed six different statistical metrics that measure the
accuracy of probabilistic classification. Conclusions. Our results show that
pyUPMASK is better performant than UPMASK for every statistical performance
metric, while still managing to be many times faster.
