ยง 1020. Substitution of indemnitors for executing or attaching officer. Where an action is brought against an officer to recover a chattel levied upon by virtue of an execution or order of attachment, or to recover damages for the detention or sale of such a chattel, and an undertaking indemnifying the officer against such acts has been given, the court may order that the indemnitor be substituted for the officer.