code: def format_value(value):
      
      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))
docs: Returns the given value rounded to one decimal place if deciaml.
  
      Returns the integer if an integer is given.