def apply_formatter(formatter, *args, **kwargs):
    """
    Used by QAbstractModel data method
    Configures a formatter for one field, apply the formatter with the new index data
    :param formatter: formatter. If can be None/dict/callback or just any type of value
    :param args:
    :param kwargs:
    :return:
    """

    if formatter is None:
        return args[0]
    elif isinstance(formatter, dict):
        return formatter.get(args[0], None)
    elif callable(formatter):
        return formatter(*args, **kwargs)

    return formatter