<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_filter(sdk_filter, attr_map):
 """Common functionality for filter structures """

    if not isinstance(sdk_filter, dict):
        raise CloudValueError('filter value must be a dictionary, was %r' % (sdk_filter,))
    custom = sdk_filter.pop('custom_attributes', {})
    new_filter = _normalise_key_values(filter_obj=sdk_filter, attr_map=attr_map)
    new_filter.update({
        'custom_attributes__%s' % k: v for k, v in _normalise_key_values(filter_obj=custom).items()
    })
    return new_filter