input: 
  def sort_words(my_string: str) -> str:
      """ Sort words in a given string by their length in decreasing order. 
      If two words have the same length, they should be ordered alphabetically.
      >>> sort_words("This is the string which is to be sorted")
      'be which sorted string This the to is'
      """
      words = my_string.split(' ') 
      words_with_length = [(len(word), word) for word in words] 
      words_with_length.sort(key=lambda x: (-x[0], x[1])) 
      sorted_string = " ".join([i[1] for i in words_with_length]) 
      return sorted_string
  
output:     words = my_string.split(' ') 
      words_with_length = [(len(word), word) for word in words] 
      words_with_length.sort(key=lambda x: (-x[0], x[1])) 
      sorted_string = " ".join([i[1] for i in words_with_length]) 
      return sorted_string