(a) Except as otherwise provided in this article, in any civil action commenced or appealed in any court of record in this state, the court shall award, as part of its judgment and in addition to any other costs otherwise assessed, reasonable attorneys' fees and costs against any attorney or party, or both, who has brought a civil action, or asserted a claim therein, or interposed a defense, that a court determines to be without substantial justification, either in whole or part;
(b) When a court determines reasonable attorneys' fees or costs should be assessed it shall assess the payment thereof against the offending attorneys or parties, or both, and in its discretion may allocate among them, as it determines most just, and may assess the full amount or any portion thereof to any offending attorney or party;
(c) The court shall assess attorneys' fees and costs against any party or attorney if the court, upon the motion of any party or on its own motion, finds that an attorney or party brought an action or any part thereof, or asserted any claim or defense therein, that is without substantial justification, or that the action or any part thereof, or any claim or defense therein, was interposed for delay or harassment, or if it finds that an attorney or party unnecessarily expanded the proceedings by other improper conduct including but not limited to abuses of discovery procedures available under the Alabama Rules of Civil Procedure;
(d) No attorneys' fees or costs shall be assessed if a voluntary dismissal is filed as to any action, claim or defense within 90 days after filing, or during any reasonable extension granted by the court, for good cause shown, on motion filed prior to the expiration of said 90 day period;
(e) No party, except an attorney licensed to practice law in this state, who is appearing without an attorney shall be assessed attorneys' fees unless the court finds that the party clearly knew or reasonably should have known that his action, claim or defense or any part thereof was without substantial justification.