@staticmethod
def simplify(top, bottom):
    """Removes equal items from top and bottom in a one-to-one
        correspondence.

        Signatures are simplified on initialization::

           >>> Signature('abcxa', 'bxay')
           {c, a}/{y}

        This function takes top and bottom and returns simplified
        tuples for top and bottom.

        """
    top = [] if top is None else list(top)
    bottom = [] if bottom is None else list(bottom)
    i = 0
    while i < len(top):
        j = 0
        while j < len(bottom) and bottom[j] != top[i]:
            j += 1
        if j < len(bottom):
            assert bottom[j] == top[i]
            del bottom[j]
            del top[i]
        else:
            i += 1
    return tuple(top), tuple(bottom)
