Trim and reorder the attributes to the specifications in a restriction
        list.

def trim(self, restriction_list):
        """
        Trim and reorder the attributes to the specifications in a restriction
        list.
        """
        replacement = []
        for reference in restriction_list:
            replacement.append(self.get_attribute(reference))

        if self.has_duplicates(replacement):
            raise AttributeReferenceError('Duplicate attribute reference.')
        self._contents = replacement