not sure if i prefer it, but one option is to do this check at the end and remove keys where val is None