def METHOD_NAME(value, prec):
    if isinstance(value, float):
        return round(value, prec)
    # can also use shift() here but that is 2.6 only
    return (value * decimal.Decimal("1" + "0" * prec)
            ).to_integral(decimal.ROUND_FLOOR) / \
        pow(10, prec)