def format_value(value):
    """
    Integers are numeric values that do not include a decimal and are followed by a trailing i when inserted
    (e.g. 1i, 345i, 2015i, -10i). Note that all values must have a trailing i.
    If they do not they will be written as floats.

    Floats are numeric values that are not followed by a trailing i. (e.g. 1, 1.0, -3.14, 6.0e5, 10).

    Boolean values indicate true or false. Valid boolean strings for line protocol are
    (t, T, true, True, TRUE, f, F, false, False and FALSE).

    Strings are text values. All string field values must be surrounded in double-quotes ".
    If the string contains a double-quote, the double-quote must be escaped with a backslash, e.g. \".
    """
    if isinstance(value, basestring):
        value = value.replace('"', '\"')
        value = u'"{0}"'.format(value)
    elif isinstance(value, bool):
        value = str(value)
    elif isinstance(value, int):
        value = "{0}i".format(value)
    elif isinstance(value, float):
        value = str(value)
    return value
Integers are numeric values that do not include a decimal and are followed by a trailing i when inserted
    (e.g. 1i, 345i, 2015i, -10i). Note that all values must have a trailing i.
    If they do not they will be written as floats.

    Floats are numeric values that are not followed by a trailing i. (e.g. 1, 1.0, -3.14, 6.0e5, 10).

    Boolean values indicate true or false. Valid boolean strings for line protocol are
    (t, T, true, True, TRUE, f, F, false, False and FALSE).

    Strings are text values. All string field values must be surrounded in double-quotes ".
    If the string contains a double-quote, the double-quote must be escaped with a backslash, e.g. \".