code: def decimal_format(value, TWOPLACES=Decimal(100) ** -2):
      'Format a decimal.Decimal like to 2 decimal places.'
      if not isinstance(value, Decimal):
          value = Decimal(str(value))
      return value.quantize(TWOPLACESf decimal_format(value, TWOPLACES=Decimal(100) ** -2):
      'Format a decimal.Decimal like to 2 decimal places.'
      if not isinstance(value, Decimal):
          value = Decimal(str(value))
      return value.quantize(TWOPLACES)
docs: Format a decimal.Decimal like to 2 decimal places.