It seems that`ds_opts[s_opt]` can be replaced with `v` defined a few lines before (I still haven't wrapped my head around how the whole thing works).