nodes: 0, module; 1, function_definition; 2, function_name:sorted_keywords_by_order; 3, parameters; 4, block; 5, identifier:keywords; 6, identifier:order; 7, expression_statement; 8, comment:# we need to delete item with no value; 9, for_statement; 10, expression_statement; 11, for_statement; 12, for_statement; 13, return_statement; 14, comment:"""Sort keywords based on defined order.
  
      :param keywords: Keyword to be sorted.
      :type keywords: dict
  
      :param order: Ordered list of key.
      :type order: list
  
      :return: Ordered dictionary based on order list.
      :rtype: OrderedDict
      """; 15, pattern_list; 16, call; 17, block; 18, assignment; 19, identifier:key; 20, identifier:order; 21, block; 22, identifier:keyword; 23, identifier:keywords; 24, block; 25, identifier:ordered_keywords; 26, identifier:key; 27, identifier:value; 28, identifier:list; 29, argument_list; 30, if_statement; 31, identifier:ordered_keywords; 32, call; 33, if_statement; 34, if_statement; 35, call; 36, comparison_operator:value is None; 37, block; 38, identifier:OrderedDict; 39, argument_list; 40, comparison_operator:key in list(keywords.keys()); 41, block; 42, comparison_operator:keyword not in order; 43, block; 44, attribute; 45, argument_list; 46, identifier:value; 47, None; 48, delete_statement; 49, identifier:key; 50, call; 51, expression_statement; 52, identifier:keyword; 53, identifier:order; 54, expression_statement; 55, identifier:keywords; 56, identifier:items; 57, subscript; 58, identifier:list; 59, argument_list; 60, assignment; 61, assignment; 62, identifier:keywords; 63, identifier:key; 64, call; 65, subscript; 66, call; 67, subscript; 68, call; 69, attribute; 70, argument_list; 71, identifier:ordered_keywords; 72, identifier:key; 73, attribute; 74, argument_list; 75, identifier:ordered_keywords; 76, identifier:keyword; 77, attribute; 78, argument_list; 79, identifier:keywords; 80, identifier:keys; 81, identifier:keywords; 82, identifier:get; 83, identifier:key; 84, identifier:keywords; 85, identifier:get; 86, identifier:keyword
code: def sorted_keywords_by_order(keywords, order):
      """Sort keywords based on defined order.
  
      :param keywords: Keyword to be sorted.
      :type keywords: dict
  
      :param order: Ordered list of key.
      :type order: list
  
      :return: Ordered dictionary based on order list.
      :rtype: OrderedDict
      """
  
      # we need to delete item with no value
      for key, value in list(keywords.items()):
          if value is None:
              del keywords[key]
  
      ordered_keywords = OrderedDict()
      for key in order:
          if key in list(keywords.keys()):
              ordered_keywords[key] = keywords.get(key)
  
      for keyword in keywords:
          if keyword not in order:
              ordered_keywords[keyword] = keywords.get(keyword)
  
      return ordered_keywords