def truncate_float(number, precision, round=False):
    """ Truncate (shorten) a floating point value at given precision """
    precision = abs(precision)
    if round:
        short_float = round(number, precision)
        """short_float = float("{0:.{1}f}".format(number, precision))
        """
    else:
        operate_on = 1
        for _ in range(precision):
            operate_on *= 10
        short_float = float(int(number * operate_on)) / operate_on
    return short_float
