code: def to_xdr_amount(value):
          
          if not isinstance(value, str):
              raise NotValidParamError("Value of type '{}' must be of type String, but got {}".format(value, type(value)))
  
          # throw exception if value * ONE has decimal places (it can't be
          # represented as int64)
          try:
              amount = int((Decimal(value) * ONE).to_integral_exact(context=Context(traps=[Inexact])))
          except decimal.Inexact:
              raise NotValidParamError("Value of '{}' must have at most 7 digits after the decimal.".format(value))
          except decimal.InvalidOperation:
              raise NotValidParamError("Value of '{}' must represent a positive number.".format(value))
          return amount
docs: Converts an amount to the appropriate value to send over the network
          as a part of an XDR object.
  
          Each asset amount is encoded as a signed 64-bit integer in the XDR
          structures. An asset amount unit (that which is seen by end users) is
          scaled down by a factor of ten million (10,000,000) to arrive at the
          native 64-bit integer representation. For example, the integer amount
          value 25,123,456 equals 2.5123456 units of the asset. This scaling
          allows for seven decimal places of precision in human-friendly amount
          units.
  
          This static method correctly multiplies the value by the scaling factor
          in order to come to the integer value used in XDR structures.
  
          See `Stellar's documentation on Asset Precision
          <https://www.stellar.org/developers/guides/concepts/assets.html#amount-precision-and-representation>`_
          for more information.
  
          :param str value: The amount to convert to an integer for XDR
              serialization.