def find_cutoff(cutplot, n_cls=None):
    """
    Finds the weight cutoff based on the longest run in cutplot.
    If n_cls is provided, finds the cutoff point where n_cls
    clusters are formed."""
    from itertools import groupby
    if n_cls != None:
        for c in cutplot:
            if c[1] == n_cls:
                return c[0]
    group = groupby(cutplot[:, (1)])
    val = max(group, key=lambda k: len(list(k[1])))[0]
    for c in cutplot:
        if c[1] == val:
            return c[0] + 0.01
