input: from typing import List
  
  
  def sort_words(my_string: str) -> str:
      """
      Sorts the words in a given string by their length in decreasing order, 
      and alphabetically in cases where words are of the same length.
  
      >>> sort_words("This is the string which is to be sorted")
      "which sorted be is This to the string"
      """
      words = my_string.split(' ')  # split string into list of words
  
      # create a list of tuples where the first element is the length of the word and the second element is the word itself
      words_with_length = [(len(word), word) for word in words]
  
      # sort list of tuples according to 1st element of tuple i.e. length of word and by the 2nd element alphabetically in reverse
      words_with_length.sort(key=lambda x: (-x[0], x[1]))
  
      # wl contains list words in decreasing order of their length and alphabetically in reverse
      # now use join() to join all words with " "
      sorted_string = " ".join([i[1] for i in words_with_length])
  
      return sorted_string
output:     words = my_string.split(' ')  # split string into list of words
  
      # create a list of tuples where the first element is the length of the word and the second element is the word itself
      words_with_length = [(len(word), word) for word in words]
  
      # sort list of tuples according to 1st element of tuple i.e. length of word and by the 2nd element alphabetically in reverse
      words_with_length.sort(key=lambda x: (-x[0], x[1]))
  
      # wl contains list words in decreasing order of their length and alphabetically in reverse
      # now use join() to join all words with " "
      sorted_string = " ".join([i[1] for i in words_with_length])
  
      return sorted_string