Appends a transformation to the TransformedStructure.

        Args:
            transformation: Transformation to append
            return_alternatives: Whether to return alternative
                TransformedStructures for one-to-many transformations.
                return_alternatives can be a number, which stipulates the
                total number of structures to return.
            clear_redo: Boolean indicating whether to clear the redo list.
                By default, this is True, meaning any appends clears the
                history of undoing. However, when using append_transformation
                to do a redo, the redo list should not be cleared to allow
                multiple redos.

def append_transformation(self, transformation, return_alternatives=False,
                              clear_redo=True):
        """
        Appends a transformation to the TransformedStructure.

        Args:
            transformation: Transformation to append
            return_alternatives: Whether to return alternative
                TransformedStructures for one-to-many transformations.
                return_alternatives can be a number, which stipulates the
                total number of structures to return.
            clear_redo: Boolean indicating whether to clear the redo list.
                By default, this is True, meaning any appends clears the
                history of undoing. However, when using append_transformation
                to do a redo, the redo list should not be cleared to allow
                multiple redos.
        """
        if clear_redo:
            self._undone = []

        if return_alternatives and transformation.is_one_to_many:
            ranked_list = transformation.apply_transformation(
                self.final_structure, return_ranked_list=return_alternatives)

            input_structure = self.final_structure.as_dict()
            alts = []
            for x in ranked_list[1:]:
                s = x.pop("structure")
                actual_transformation = x.pop("transformation", transformation)
                hdict = actual_transformation.as_dict()
                hdict["input_structure"] = input_structure
                hdict["output_parameters"] = x
                self.final_structure = s
                d = self.as_dict()
                d['history'].append(hdict)
                d['final_structure'] = s.as_dict()
                alts.append(TransformedStructure.from_dict(d))

            x = ranked_list[0]
            s = x.pop("structure")
            actual_transformation = x.pop("transformation", transformation)
            hdict = actual_transformation.as_dict()
            hdict["input_structure"] = self.final_structure.as_dict()
            hdict["output_parameters"] = x
            self.history.append(hdict)
            self.final_structure = s
            return alts
        else:
            s = transformation.apply_transformation(self.final_structure)
            hdict = transformation.as_dict()
            hdict["input_structure"] = self.final_structure.as_dict()
            hdict["output_parameters"] = {}
            self.history.append(hdict)
            self.final_structure = s