def toString(self, inObject):
        """
        Serialize a C{decimal.Decimal} instance to the specified wire format.
        """
        if isinstance(inObject, decimal.Decimal):
            # Hopefully decimal.Decimal.__str__ actually does what we want.
            return str(inObject).encode("ascii")
        raise ValueError(
            "amp.Decimal can only encode instances of decimal.Decimal")

        Serialize a C{decimal.Decimal} instance to the specified wire format.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/protocols/amp.py