def METHOD_NAME(self, session, id=None, **params):
    query = session.query(PromoCode).filter(PromoCode.uses_count == 0)
    if id is not None:
        ids = [s.strip() for s in id.split(',') if s.strip()]
        query = query.filter(PromoCode.id.in_(ids))
    result = query.delete(synchronize_session=False)
    referer = cherrypy.request.headers.get('Referer', 'index')
    page = urllib.parse.urlparse(referer).path.split('/')[-1]
    raise HTTPRedirect(page + '?message={}', '{} promo code{} deleted'.format(result, '' if result == 1 else 's'))