<s> def authorized_to_manage_request ( _ , request , current_user , pushmaster = False ) : <EOL> if pushmaster or request [ '<STR_LIT:user>' ] == current_user or ( request [ '<STR_LIT>' ] and current_user in request [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002C>' ) ) : <EOL> return True <EOL> return False <EOL> def sort_pickmes ( _ , requests , tags_order ) : <EOL> """<STR_LIT>""" <EOL> def compare_requests ( request1 , request2 ) : <EOL> tags1_list = request1 [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002C>' ) <EOL> tags2_list = request2 [ '<STR_LIT>' ] . split ( '<STR_LIT:U+002C>' ) <EOL> for tag in tags_order : <EOL> tag_in_tags1 = tag in tags1_list <EOL> tag_in_tags2 = tag in tags2_list <EOL> if tag_in_tags1 == tag_in_tags2 : <EOL> continue <EOL> elif tag_in_tags1 : <EOL> return - <NUM_LIT:1> <EOL> else : <EOL> return <NUM_LIT:1> <EOL> return cmp ( request1 [ '<STR_LIT:user>' ] , request2 [ '<STR_LIT:user>' ] ) <EOL> sorted_requests = sorted ( requests , cmp = compare_requests ) <EOL> return sorted_requests </s>
