def METHOD_NAME(issue, field_mapping):  # noqa: C901
    result = OrderedDict()
    result["key"] = issue["key"]
    for k, v in issue["fields"].items():  #
        output_name = field_mapping.get_output_field_name(k)
        member_names = field_mapping.get_dict_members(k)
        if isinstance(v, dict):
            if len(member_names) > 0:
                # if field mapping with dict member mappings defined get value of each member
                for member_name in member_names:
                    if member_name in v:
                        result[field_mapping.get_dict_output_field_name(k, member_name)] = v[member_name]
            else:
                # these special mapping rules are kept for backwards compatibility
                if "key" in v:
                    result["{}_key".format(output_name)] = v["key"]
                if "name" in v:
                    result["{}_name".format(output_name)] = v["name"]
                if k in v:
                    result[output_name] = v[k]
                if "watchCount" in v:
                    result[output_name] = v["watchCount"]
        elif isinstance(v, list):
            if len(member_names) > 0:
                # if field mapping with dict member mappings defined get value of each member
                for member_name in member_names:
                    listValues = []
                    for listItem in v:
                        if isinstance(listItem, dict):
                            if member_name in listItem:
                                listValues.append(listItem[member_name])
                    if len(listValues) > 0:
                        result[field_mapping.get_dict_output_field_name(k, member_name)] = ",".join(listValues)
            else:
                # otherwise support list values only for non-dict items
                listValues = []
                for listItem in v:
                    if not isinstance(listItem, dict):
                        listValues.append(listItem)
                if len(listValues) > 0:
                    result[output_name] = ",".join(listValues)
        else:
            result[output_name] = v
    return result