def total_ordering(cls):  
convert = {<EOL>'<STR_LIT>': [('<STR_LIT>', lambda self, other: not (self < other or self == other)),<EOL>('<STR_LIT>', lambda self, other: self < other or self == other),<EOL>('<STR_LIT>', lambda self, other: not self < other)],<EOL>'<STR_LIT>': [('<STR_LIT>', lambda self, other: not self <= other or self == other),<EOL>('<STR_LIT>', lambda self, other: self <= other and not self == other),<EOL>('<STR_LIT>', lambda self, other: not self <= other)],<EOL>'<STR_LIT>': [('<STR_LIT>', lambda self, other: not (self > other or self == other)),<EOL>('<STR_LIT>', lambda self, other: self > other or self == other),<EOL>('<STR_LIT>', lambda self, other: not self > other)],<EOL>'<STR_LIT>': [('<STR_LIT>', lambda self, other: (not self >= other) or self == other),<EOL>('<STR_LIT>', lambda self, other: self >= other and not self == other),<EOL>('<STR_LIT>', lambda self, other: not self >= other)]<EOL>}<EOL>roots = set(dir(cls)) & set(convert)<EOL>if not roots:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>root = max(roots)       <EOL>for opname, opfunc in convert[root]:<EOL><INDENT>if opname not in roots:<EOL><INDENT>opfunc.__name__ = opname<EOL>opfunc.__doc__ = getattr(int, opname).__doc__<EOL>setattr(cls, opname, opfunc)<EOL><DEDENT><DEDENT>return cls<EOL>
Class decorator that fills in missing ordering methods