If a derivative action is successful, in whole or in part, or if anything is received by the plaintiff as a result of a judgment, compromise, or settlement of an action or claim, and if the plaintiff is awarded attorney fees or costs, the court shall direct the plaintiff to remit to the limited partnership the portion of the recovery that remains after deduction of the attorney fees and costs awarded to the plaintiff.