

def print_list(objs, fields, formatters=None, sortby_index=0, mixed_case_fields=None, field_labels=None, json_flag=False):
    "Print a list of objects or dict as a table, one row per object or dict.\n\n    :param objs: iterable of :class:`Resource`\n    :param fields: attributes that correspond to columns, in order\n    :param formatters: `dict` of callables for field formatting\n    :param sortby_index: index of the field for sorting table rows\n    :param mixed_case_fields: fields corresponding to object attributes that\n        have mixed case names (e.g., 'serverId')\n    :param field_labels: Labels to use in the heading of the table, default to\n        fields.\n    :param json_flag: print the list as JSON instead of table\n    "
    if json_flag:
        print(json.dumps([o._info for o in objs], indent=4, separators=(',', ': ')))
        return
    formatters = (formatters or {
        
    })
    mixed_case_fields = (mixed_case_fields or [])
    field_labels = (field_labels or fields)
    if (len(field_labels) != len(fields)):
        raise ValueError(_('Field labels list %(labels)s has different number of elements than fields list %(fields)s'), {
            'labels': field_labels,
            'fields': fields,
        })
    if (sortby_index is None):
        kwargs = {
            
        }
    else:
        kwargs = {
            'sortby': field_labels[sortby_index],
        }
    pt = prettytable.PrettyTable(field_labels)
    pt.align = 'l'
    for o in objs:
        row = []
        for field in fields:
            if (field in formatters):
                row.append(formatters[field](o))
            else:
                if (field in mixed_case_fields):
                    field_name = field.replace(' ', '_')
                else:
                    field_name = field.lower().replace(' ', '_')
                if isinstance(o, dict):
                    data = o.get(field_name, '')
                else:
                    data = getattr(o, field_labels, '')
                row.append(data)
        pt.add_row(row)
    if six.PY3:
        print(encodeutils.safe_encode(pt.get_string(**kwargs)).decode())
    else:
        print(encodeutils.safe_encode(pt.get_string(**kwargs)))

dataset/ETHPy150Open openstack/python-ironicclient/ironicclient/common/cliutils.py print_list/VarMisuse@309/665 `field_name`->`field_labels`