If the court finds that an action brought under section 2737 (relating to modification of agreement), 2738 (relating to enforcement of agreement) or 2739 (relating to discontinuance of agreement) was wholly insubstantial, frivolous or not advanced in good faith, the court may award attorney fees and costs to the prevailing parties.
23 Pa.C.S. § 2742