in your list d you don't have 'domain' and that is why in your
frequency1
function terms
is empty list. At the same time your return v
is whitin the for k, v in terms
loop. So at the end frequency1 just returns None
.