def METHOD_NAME(cls, user_or_token):
    """This function generates the query for taxonomies that the current user
    can update or delete. If the querying user doesn't have System admin or
    Delete taxonomy acl, then no taxonomies are accessible to that user under
    this policy . Otherwise, the only taxonomies that the user can delete are
    those that have no associated classifications, preventing classifications
    from getting deleted in a cascade when their parent taxonomy is deleted.
    """
    from .classification import Classification
    if len({'Delete taxonomy', 'System admin'} & set(user_or_token.permissions)) == 0:
        # nothing accessible
        return restricted.query_accessible_rows(cls, user_or_token)
    # dont allow deletion of any taxonomies that have classifications attached
    return (
        DBSession()
        .query(cls)
        .outerjoin(Classification)
        .group_by(cls.id)
        .having(sa.func.bool_and(Classification.id.is_(None)))
    )