def METHOD_NAME(expr):
    """Remove identities."""
    ids = list(map(isid, arguments(expr)))
    if sum(ids) == 0:           # No identities. Common case
        return expr
    if sum(ids) != len(ids):  # there is at least one non-identity
        return term(operator(expr),
                    [arg for arg, x in zip(arguments(expr), ids) if not x])
    return term(operator(expr), [arguments(expr)[0]])