def _reset_dmats(shape_dmats, indices):
    """Set values in dmats equal to the identity matrix."""
    f_assign = format['assign']
    f_float = format['floating point']
    i, j = indices
    code = [format['comment'](
        'Resetting dmats values to compute next derivative.')]
    dmats_old = format['component'](format['dmats'](''), [i, j])
    lines = [f_assign(dmats_old, f_float(0.0))]
    lines += [format['if'](i + format['is equal'] + j, f_assign(dmats_old,
        f_float(1.0)))]
    loop_vars = [(i, 0, shape_dmats[0]), (j, 0, shape_dmats[1])]
    code += format['generate loop'](lines, loop_vars)
    return code
