def _build_requested_filter(requested_filter):
 all_filters = {'Images': ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/tiff', 'image/tif', 'image/x-icon'], 'Documents': ['application/pdf', 'text/plain', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'application/msword', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint']}
 requested_file_types = all_filters.get(requested_filter, None)
 where = ["JSON.stringify(this.contentType).toUpperCase() == JSON.stringify('{}').toUpperCase()".format(req_filter) for req_filter in requested_file_types]
 filter_params = {'$where': ' || '.join(where)}
 return filter_params

def _build_requested_filter ( requested_filter ) : all_filters = { 'Images' : [ 'image/png' , 'image/jpeg' , 'image/jpg' , 'image/gif' , 'image/tiff' , 'image/tif' , 'image/x-icon' ] , 'Documents' : [ 'application/pdf' , 'text/plain' , 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' , 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' , 'application/vnd.openxmlformats-officedocument.presentationml.presentation' , 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' , 'application/vnd.openxmlformats-officedocument.presentationml.template' , 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' , 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' , 'application/msword' , 'application/vnd.ms-excel' , 'application/vnd.ms-powerpoint' ] } requested_file_types = all_filters . get ( requested_filter , None ) where = [ "JSON.stringify(this.contentType).toUpperCase() == JSON.stringify('{}').toUpperCase()" . format ( req_filter ) for req_filter in requested_file_types ] filter_params = { '$where' : ' || ' . join ( where ) } return filter_params
returns requested filter_params string .