code: def legacy_filter_formatter(kwargs, attr_map):
      
      params = _depluralise_filters_key(copy.copy(kwargs))
      new_filter = _get_filter(sdk_filter=params.pop('filter', {}), attr_map=attr_map)
      if new_filter:
          new_filter = sorted([(k.rsplit('__eq')[0], v) for k, v in new_filter.items()])
          params['filter'] = urllib.parse.urlencode(new_filter)
      return params
docs: Builds a filter for update and device apis
  
      :param kwargs: expected to contain {'filter/filters': {filter dict}}
      :returns: {'filter': 'url-encoded-validated-filter-string'}