'Mark given group deleted/undeleted based on the flag.'

def delete(self, trans, group, undelete=False):

    if (not trans.user_is_admin()):
        raise ItemAccessibilityException('Only    administrators    can    delete    and    undelete    groups.')
    if undelete:
        group.deleted = False
    else:
        group.deleted = True
    trans.sa_session.add(group)
    trans.sa_session.flush()
    return group
