code: def safe_trim(qty_as_string):
      '''
      Safe trimming means the following:
          1.0010000 -> 1.001
          1.0 -> 1.0 (no change)
          1.0000001 -> 1.0000001 (no change)
      '''
      qty_formatted = qty_as_string
      if '.' in qty_as_string:
          # only affect numbers with decimals
          while True:
              if qty_formatted[-1] == '0' and qty_formatted[-2] != '.':
                  qty_formatted = qty_formatted[:-1]
              else:
                  break
  
      return qty_formattef safe_trim(qty_as_string):
      '''
      Safe trimming means the following:
          1.0010000 -> 1.001
          1.0 -> 1.0 (no change)
          1.0000001 -> 1.0000001 (no change)
      '''
      qty_formatted = qty_as_string
      if '.' in qty_as_string:
          # only affect numbers with decimals
          while True:
              if qty_formatted[-1] == '0' and qty_formatted[-2] != '.':
                  qty_formatted = qty_formatted[:-1]
              else:
                  break
  
      return qty_formatted
docs: Safe trimming means the following:
          1.0010000 -> 1.001
          1.0 -> 1.0 (no change)
          1.0000001 -> 1.0000001 (no change)