Alternative fix for #28

Based on the discussion in https://github.com/ansible/ansible-modules-core/pull/28 a alternative way of solving the issue. I personally don't mind either way but I think it would be great if you would pull in the unittest so that this kind of code is easier to change in the future.