Returns (typetag, text, is_imprecise). Unlike other functions that operate
    on measurements, this also operates on bools, ints, and strings.

def fmtinfo(value):
    """Returns (typetag, text, is_imprecise). Unlike other functions that operate
    on measurements, this also operates on bools, ints, and strings.

    """
    if value is None:
        raise ValueError('cannot format None!')

    if isinstance(value, text_type):
        return '', value, False

    if isinstance(value, bool):
        # Note: isinstance(True, int) = True, so this must come before the next case.
        if value:
            return 'b', 'y', False
        return 'b', '', False

    if isinstance(value, six.integer_types):
        return 'i', text_type(value), False

    if isinstance(value, float):
        return 'f', text_type(value), True

    if hasattr(value, '__pk_fmtinfo__'):
        return value.__pk_fmtinfo__()

    raise ValueError('don\'t know how to format %r as a measurement' % value)