helper function for simple_round (a factory for simple_round functions)

def simple_round_factory(tol):
    """helper function for simple_round (a factory for simple_round functions)"""
    def simple_round(*args, **kwds):
        argstype = type(args)
        _args = list(args)
        _kwds = kwds.copy()
        for i,j in enumerate(args): # args[0] is the class.
            if isinstance(j, float): _args[i] = round(j, tol[i - 1] \
                if isinstance(tol, (list, tuple)) else tol) # don't round int
        for k, (i,j) in enumerate(kwds.items()):
            if isinstance(j, float): _kwds[i] = round(j, tol[k] \
                if isinstance(tol, (list, tuple)) else tol)
        return argstype(_args), _kwds
    return simple_round