def process_parens(taxon):
    """subgenera are parenthesized; if this occurs in the name of a
       species or lower ranked taxon, strip out the subgenus reference;
       if the taxon is the subgenus, assume the parenthesized portion is
       the subgenus name, so strip out the genus name that preceeds it and
       parens.  If it doesn't fit the pattern, fail."""
    if 'rank' not in taxon:  # unfortunate edge case
        return taxon
    name = taxon['name']
    if taxon['rank'] == 'subgenus':
        if name.find('(') > -1:
            open = name.find('(')
            close = name.find(')')
            if close > open:
                name = name[0:open -1]
                taxon['name'] = name
    elif name.find('(') > -1:
        if name.find('(') > -1:
            open = name.find('(')
            close = name.find(')')
            if close > open:
                name = name[0:open] + name[close+2:]
                taxon['name'] = name
    return taxon