def delete(self,removed):
        """Remove a single record, or the records in an iterable
        Before starting deletion, test if all records are in the base
        and don't have twice the same __id__
        Return the number of deleted items
        """
        sql = "DELETE FROM %s " %self.name
        if isinstance(removed,dict):
            # remove a single record
            _id = removed['__id__']
            sql += "WHERE rowid = ?"
            args = (_id,)
        else:
            # convert iterable into a list (to be able to sort it)
            removed = [ r for r in removed ]
            if not removed:
                return 0
            args = [ r['__id__'] for r in removed ]
            sql += "WHERE rowid IN (%s)" %(','.join(['?']*len(args)))
        self.cursor.execute(sql,args)
        return len(removed)