def ansible_dict_to_boto3_filter_list(filters_dict):
 filters_list = []
 for (k, v) in filters_dict.items():
  filter_dict = {'Name': k}
  if isinstance(v, string_types):
   filter_dict['Values'] = [v]
  else:
   filter_dict['Values'] = v
  filters_list.append(filter_dict)
 return filters_list

def ansible_dict_to_boto3_filter_list ( filters_dict ) : filters_list = [ ] for ( k , v ) in filters_dict . items ( ) : filter_dict = { 'Name' : k } if isinstance ( v , string_types ) : filter_dict [ 'Values' ] = [ v ] else : filter_dict [ 'Values' ] = v filters_list . append ( filter_dict ) return filters_list
convert an ansible dict of filters to list of dicts that boto3 can use args: filters_dict : dict of aws filters .