def prunelist(targetlist, counter='', minimum=True, reverse=False, all=True):
    """prunelist(list[,counter,minimum,reverse,all]) --> pruned list"""
    m = []
    for item in targetlist:
        m.append(item.count(counter))
    if reverse:
        m.reverse()
        targetlist.reverse()
    if not m:
        if all == True:
            return []
        else:
            return ''
    if minimum:
        x = min(m)
    else:
        x = max(m)
    if not all:
        return targetlist[m.index(x)]
    shortlist = []
    tmp = []
    for item in targetlist:
        tmp.append(item)
    occurances = m.count(x)
    for i in range(occurances):
        shortlist.append(tmp.pop(m.index(x)))
        m.pop(m.index(x))
    return shortlist
