Oskar Ewerlöf (1876–1934), Schwedischer Jurist und Diplomat