Let $k$ be a totally real number field of degree $n$.
I'd like to know how I can determine whether or not there exists a quadratic field extension $L$ of $k$ such that the extension $L/k$ is unramified at all finite primes and ramified at only at $n-1$ of the real primes of $k$. I assume that this can be determined by class field theory. For the application that I have in mind however, I'm going to need a computer algebra system like sage to be able to explicitly perform this test. How explicit can this be made?
Thanks.