Returns the given value rounded to one decimal place if deciaml.

    Returns the integer if an integer is given.

def format_value(value):
    """Returns the given value rounded to one decimal place if deciaml.

    Returns the integer if an integer is given.
    """
    value = decimal.Decimal(str(value))
    if int(value) == value:
        return int(value)

    # On Python 3, an explicit cast to float is required
    return float(round(value, 1))