def boto3_tag_list_to_ansible_dict(tags_list):
 tags_dict = {}
 for tag in tags_list:
  if ('key' in tag):
   tags_dict[tag['key']] = tag['value']
  elif ('Key' in tag):
   tags_dict[tag['Key']] = tag['Value']
 return tags_dict

def boto3_tag_list_to_ansible_dict ( tags_list ) : tags_dict = { } for tag in tags_list : if ( 'key' in tag ) : tags_dict [ tag [ 'key' ] ] = tag [ 'value' ] elif ( 'Key' in tag ) : tags_dict [ tag [ 'Key' ] ] = tag [ 'Value' ] return tags_dict
convert a boto3 list of resource tags to a flat dict of key:value pairs args: tags_list : list of dicts representing aws tags .