def pretty_float_formatter(field, ndigits=None):
    """Create a float value formatter function for the given field.

    :param field: str name of an object, which value should be formatted
    :param ndigits: int number of digits after decimal point to round
                    default is None - this disables rounding
    :returns: field formatter function
    """
    def _formatter(obj):
        value = obj[field] if type(obj) == dict else getattr(obj, field)
        if (int, float) in type(value):
            if ndigits:
                return round(value, ndigits)
            return value
        return "n/a"
    return _formatter
dataset/ETHPy150Open openstack/rally/rally/cli/cliutils.py/pretty_float_formatter/swapped operands of `in`