selectattr : multiples attributes "defined" ?

Hi,

i am trying to filter a list containg items with differents attributes which may exist or not. I know to to do it with one attrobute, but how to select multiple attributes which may not exist?

exemple below can filter and get one attribute (port-tcprange) , but i need udp-portrange too and i don't know how to do it:

is there a way to make multi-attributes selection?

- name: find items from attributes tcp-portrange and udp-portrange, if they exist
vars:
response_data:
- color: 0
udp-portrange: [5-7000]
- color: 1
tcp-portrange: ["1-65535"]
udp-portrange":
- color: 2
tcp-portrange: ["12"]
- color: 3
galaxy: "andromeda"
set_fact:
y: "{{ response_data | selectattr('tcp-portrange', 'defined') | map(attribute='tcp-portrange') | flatten}}"
tags:
- test-regles3-3
- name: show y
debug:
msg: "valeur de y: {{ y }}"
tags:
- test-regles3-3

results: ['1-65535', '12']"