nodes: 0, module; 1, function_definition; 2, function_name:_prepare_sort_by_score; 3, parameters; 4, block; 5, identifier:self; 6, identifier:values; 7, identifier:sort_options; 8, expression_statement; 9, comment:# create the keys; 10, expression_statement; 11, comment:# ask to sort on our new keys; 12, expression_statement; 13, comment:# retrieve original sort parameters; 14, for_statement; 15, comment:# if we want to get the score with values/values_list; 16, if_statement; 17, return_statement; 18, comment:"""
          Create the key to sort on the sorted set references in
          self._sort_by_sortedset and adapte sort options
          """; 19, assignment; 20, assignment; 21, identifier:key; 22, tuple; 23, block; 24, call; 25, block; 26, expression_list; 27, pattern_list; 28, call; 29, subscript; 30, binary_operator:'%s:*' % base_tmp_key; 31, string; 32, string; 33, string; 34, string; 35, if_statement; 36, attribute; 37, argument_list; 38, try_statement; 39, identifier:base_tmp_key; 40, identifier:tmp_keys; 41, identifier:base_tmp_key; 42, identifier:tmp_keys; 43, attribute; 44, argument_list; 45, identifier:sort_options; 46, string; 47, string; 48, identifier:base_tmp_key; 49, string_content:desc; 50, string_content:alpha; 51, string_content:get; 52, string_content:store; 53, comparison_operator:key in self._sort_by_sortedset; 54, block; 55, identifier:sort_options; 56, identifier:get; 57, string; 58, block; 59, except_clause; 60, else_clause; 61, identifier:self; 62, identifier:_zset_to_keys; 63, keyword_argument; 64, keyword_argument; 65, string_content:by; 66, string_content:%s:*; 67, identifier:key; 68, attribute; 69, expression_statement; 70, string_content:get; 71, expression_statement; 72, block; 73, block; 74, identifier:key; 75, subscript; 76, identifier:values; 77, identifier:values; 78, identifier:self; 79, identifier:_sort_by_sortedset; 80, assignment; 81, assignment; 82, pass_statement; 83, expression_statement; 84, attribute; 85, string; 86, subscript; 87, subscript; 88, identifier:pos; 89, call; 90, assignment; 91, identifier:self; 92, identifier:_sort_by_sortedset; 93, string_content:by; 94, identifier:sort_options; 95, identifier:key; 96, attribute; 97, identifier:key; 98, attribute; 99, argument_list; 100, subscript; 101, binary_operator:'%s:*' % base_tmp_key; 102, identifier:self; 103, identifier:_sort_by_sortedset; 104, subscript; 105, identifier:index; 106, identifier:SORTED_SCORE; 107, subscript; 108, identifier:pos; 109, string; 110, identifier:base_tmp_key; 111, identifier:sort_options; 112, string; 113, identifier:sort_options; 114, string; 115, string_content:%s:*; 116, string_content:get; 117, string_content:get
code: def _prepare_sort_by_score(self, values, sort_options):
          """
          Create the key to sort on the sorted set references in
          self._sort_by_sortedset and adapte sort options
          """
          # create the keys
          base_tmp_key, tmp_keys = self._zset_to_keys(
                                      key=self._sort_by_sortedset['by'],
                                      values=values,
                                      )
          # ask to sort on our new keys
          sort_options['by'] = '%s:*' % base_tmp_key
  
          # retrieve original sort parameters
          for key in ('desc', 'alpha', 'get', 'store'):
              if key in self._sort_by_sortedset:
                  sort_options[key] = self._sort_by_sortedset[key]
  
          # if we want to get the score with values/values_list
          if sort_options.get('get'):
              try:
                  pos = sort_options['get'].index(SORTED_SCORE)
              except:
                  pass
              else:
                  sort_options['get'][pos] = '%s:*' % base_tmp_key
  
          return base_tmp_key, tmp_keys