code: def number_to_string(number, significant_digits, number_format_notation="f"):
      
      try:
          using = number_formatting[number_format_notation]
      except KeyError:
          raise ValueError("number_format_notation got invalid value of {}. The valid values are 'f' and 'e'".format(number_format_notation)) from None
      if isinstance(number, Decimal):
          tup = number.as_tuple()
          with localcontext() as ctx:
              ctx.prec = len(tup.digits) + tup.exponent + significant_digits
              number = number.quantize(Decimal('0.' + '0' * significant_digits))
      result = (using % significant_digits).format(number)
      # Special case for 0: "-0.00" should compare equal to "0.00"
      if set(result) <= ZERO_DECIMAL_CHARACTERS:
          result = "0.00"
      # https://bugs.python.org/issue36622
      if number_format_notation == 'e' and isinstance(number, float):
          result = result.replace('+0', '+')
      return result
docs: Convert numbers to string considering significant digits.