'If val is empty, deletes identifier of type typ'

def set_identifier(self, id_, typ, val, notify=True, commit=True):

    (typ, val) = self._clean_identifier(typ, val)
    identifiers = self.get_identifiers(id_, index_is_id=True)
    if (not typ):
        return
    changed = False
    if ((not val) and (typ in identifiers)):
        identifiers.pop(typ)
        changed = True
        self.conn.execute('DELETE    from    identifiers    WHERE    book=?    AND    type=?', (id_, typ))
    if (val and (identifiers.get(typ, None) != val)):
        changed = True
        identifiers[typ] = val
        self.conn.execute('INSERT    OR    REPLACE    INTO    identifiers    (book,    type,    val)    VALUES    (?,    ?,    ?)', (id_, typ, val))
    if changed:
        raw = ','.join([('%s:%s' % (k, v)) for (k, v) in identifiers.iteritems()])
        self.data.set(id_, self.FIELD_MAP['identifiers'], raw, row_is_id=True)
        if commit:
            self.conn.commit()
        if notify:
            self.notify('metadata', [id_])
