def base_round_zero(val, n): if val is not None: val = Decimal(val, getcontext()) else: val = Decimal(0, getcontext()) return val.__round__(n)