def pop(queue, quantity=1):
    '''
    Pop one or more or all items from the queue return them.
    '''
    cmd = 'SELECT name FROM {0}'.format(queue)
    if quantity != 'all':
        try:
            quantity = int(quantity)
        except __HOLE__ as exc:
            error_txt = ('Quantity must be an integer or "all".\n'
                         'Error: "{0}".'.format(exc))
            raise SaltInvocationError(error_txt)
        cmd = ''.join([cmd, ' LIMIT {0}'.format(quantity)])
    log.debug('SQL Query: {0}'.format(cmd))
    con = _conn(queue)
    items = []
    with con:
        cur = con.cursor()
        result = cur.execute(cmd).fetchall()
        if len(result) > 0:
            items = [item[0] for item in result]
            itemlist = '","'.join(items)
            _quote_escape(itemlist)
            del_cmd = '''DELETE FROM {0} WHERE name IN ("{1}")'''.format(
                queue, itemlist)

            log.debug('SQL Query: {0}'.format(del_cmd))

            cur.execute(del_cmd)
        con.commit()
    log.info(items)
    return items
dataset/ETHPy150Open saltstack/salt/salt/queues/sqlite_queue.py/pop