or a state agency is a party or has a direct and substantial interest, without violating M.G.L. c. 268A, ?? 4(a) or (c) or ?? 7, provided that such attorney complies in every respect with the provisions of the Massachusetts Rules of Professional Conduct.(5) Exemption