What about
function dostuff(dict, key)
found = true
item = get(() -> found = false, dict, key)
if found
Some(item)
else
nothing
end
end
d = Dict([1 => 'a'])
dostuff(d, 1) # Some('a')
dostuff(d, 2) # nothing