def format_nonunique_key_error(obj, fields, others):
    template = "Object in source database can't be uniquely linked to target database.\nProblematic dataset is:\n{ds}\nPossible targets include (at least one not shown):\n{targets}"
    fields_to_print = (list((fields or DEFAULT_FIELDS)) + ['filename'])
    _ = (lambda x: {field: x.get(field, '(missing)') for field in fields_to_print})
    return template.format(ds=pprint.pformat(_(obj)), targets=pprint.pformat([_(x) for x in others]))
def format_nonunique_key_error(obj, fields, others):
    template = "Object in source database can't be uniquely linked to target database.\nProblematic dataset is:\n{ds}\nPossible targets include (at least one not shown):\n{targets}"
    fields_to_print = (list((fields or DEFAULT_FIELDS)) + ['filename'])
    _ = (lambda x: {field: x.get(field, '(missing)') for field in fields_to_print})
    return template.format(ds=pprint.pformat(_(obj)), targets=pprint.pformat([_(x) for x in others]))