def do_reverse(value):
 if isinstance(value, basestring):
  return value[::(-1)]
 try:
  return reversed(value)
 except TypeError:
  try:
   rv = list(value)
   rv.reverse()
   return rv
  except TypeError:
   raise FilterArgumentError('argument must be iterable')

def do_reverse ( value ) : if isinstance ( value , basestring ) : return value [ : : ( - 1 ) ] try : return reversed ( value ) except TypeError : try : rv = list ( value ) rv . reverse ( ) return rv except TypeError : raise FilterArgumentError ( 'argument must be iterable' )
reverse the object or return an iterator the iterates over it the other way round .