def _escape(value):
        """Escape a string (key or value) for InfluxDB's line protocol.

        :param str|int|float|bool value: The value to be escaped
        :rtype: str

        """
        value = str(value)
        for char, escaped in {' ': '\ ', ',': '\,', '"': '\"'}.items():
            value = value.replace(char, escaped)
        return value
def _escape ( value ) : value = str ( value ) for char , escaped in { ' ' : '\ ' , ',' : '\,' , '"' : '\"' } . items ( ) : value = value . replace ( char , escaped ) return value
Escape a string (key or value) for InfluxDB's line protocol.

        :param str|int|float|bool value: The value to be escaped
        :rtype: str