#NEWLINE# def _remove_repeated( inds ) : #NEWLINE# #INDENT# 'Removes repeated objects from sequences\n\n    Returns a set of the unique objects and a tuple of all that have been\n    removed.\n\n    >>> from sympy.tensor.index_methods import _remove_repeated\n    >>> l1 = [1, 2, 3, 2]\n    >>> _remove_repeated(l1)\n    (set([1, 3]), (2,))\n\n    ' #NEWLINE# sum_index = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for i in inds : #NEWLINE# #INDENT# if ( i in sum_index ) : #NEWLINE# #INDENT# sum_index [ i ] += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sum_index [ i ] = 0 #NEWLINE# #UNINDENT# #UNINDENT# inds = [ x for x in inds if ( not sum_index [ x ] ) ] #NEWLINE# return ( set ( inds ) , tuple ( [ i for i in sum_index if sum_index [ i ] ] ) )