Generalizing Importance Weighting to A Universal Solver for Distribution Shift Problems