def create_float_data_func(attribute='text', fmt="%.5f", invalid="#NA#"):
    """
        Creates a data function that can be used to render floats as formatted
        strings, with detection of invalid values (e.g. None)
    """
    def float_renderer(column, cell, model, itr, args=None):
        nr = model.get_value(itr, column.get_col_attr(attribute))
        try:
            cell.set_property('text', fmt % nr)
        except:
            cell.set_property('text', invalid)
    return float_renderer