def deduplicate(self, aligned_sequence_objects):
sequence_to_groups = {}<EOL>for s in aligned_sequence_objects:<EOL><INDENT>try:<EOL><INDENT>sequence_to_groups[s.seq].append(s)<EOL><DEDENT>except KeyError:<EOL><INDENT>sequence_to_groups[s.seq] = [s]<EOL><DEDENT><DEDENT>return sequence_to_groups.values()<EOL>
r"""Sort the given aligned_sequence objects into an array of arrays,
        where input sequences are grouped iff they have the same sequence

        Parameters
        ----------
        aligned_sequence_objects: array of Sequence objects
            input sequences

        Returns
        -------
        Array of arrays of Sequence objects