input: 
  from typing import List, Tuple
  
  def sort_words_by_length(input_str: str) -> str:
      """ Convert the input string into a string of words sorted by their length in 
      descending order and if words have the same length, sort them in their original 
      lexicographical order. Words are separated by spaces in the input string. 
      
      >>> sort_words_by_length("This is the string which is to be sorted")
      'string sorted which This the to be is'
      >>> sort_words_by_length("Write a response that appropriately completes the request")
      'appropriately completes request that Write the a'
      """
      words = input_str.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 (length) in descending, 
      # and 2nd element (lexicographical order) caret keeps as tie-breaker
      words_with_length.sort(key=lambda x: (-x[0], x[1])) 
      
      # wl contains list words in decreasing order of their length 
      # now use join() to join all words whith " " 
      sorted_string = " ".join([i[1] for i in words_with_length]) 
      
      return sorted_string
  
output:     words = input_str.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 (length) in descending,
      # and 2nd element (lexicographical order) caret keeps as tie-breaker
      words_with_length.sort(key=lambda x: (-x[0], x[1]))
  
      # wl contains list words in decreasing order of their length
      # now use join() to join all words with " "
      sorted_string = " ".join([i[1] for i in words_with_length])
  
      return sorted_string