go to any length
Also, go to great lengths. Take a great deal of trouble for something, go to extremes. For example, He'll go to great lengths to make a perfect chocolate cake, or, as Benjamin Disraeli put it in Coningsby (1844): "He would go ... [to] any lengths for his party."