def get_field(item, field):
    try:
        if isinstance(item, dict):
            return item[field]
        else:
            return getattr(item, field)
    except Exception:
        msg = field % "Resource doesn't have field %s"
        raise exceptions.CommandError(msg)
dataset/ETHPy150Open dtroyer/python-openstackclient/openstackclient/common/utils.py/get_field/swapped operands of `%`