nodes: 0, module; 1, function_definition; 2, function_name:ffd; 3, parameters; 4, block; 5, identifier:items; 6, identifier:targets; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:kwargs; 14, comment:"""First-Fit Decreasing
  
      This is perhaps the simplest packing heuristic;
      it simply packs items in the next available bin.
  
      This algorithm differs only from Next-Fit Decreasing
      in having a 'sort'; that is, the items are pre-sorted
      (largest to smallest).
  
      Complexity O(n^2)
      """; 15, assignment; 16, assignment; 17, assignment; 18, call; 19, identifier:sizes; 20, call; 21, identifier:sizes; 22, call; 23, identifier:items; 24, call; 25, identifier:ff; 26, argument_list; 27, identifier:zip; 28, argument_list; 29, identifier:sorted; 30, argument_list; 31, identifier:map; 32, argument_list; 33, identifier:items; 34, identifier:targets; 35, identifier:items; 36, call; 37, identifier:sizes; 38, keyword_argument; 39, keyword_argument; 40, call; 41, identifier:sizes; 42, identifier:weight; 43, argument_list; 44, identifier:key; 45, call; 46, identifier:reverse; 47, True; 48, attribute; 49, argument_list; 50, identifier:items; 51, dictionary_splat; 52, attribute; 53, argument_list; 54, identifier:operator; 55, identifier:itemgetter; 56, integer:0; 57, identifier:kwargs; 58, identifier:operator; 59, identifier:itemgetter; 60, integer:1
code: def ffd(items, targets, **kwargs):
      """First-Fit Decreasing
  
      This is perhaps the simplest packing heuristic;
      it simply packs items in the next available bin.
  
      This algorithm differs only from Next-Fit Decreasing
      in having a 'sort'; that is, the items are pre-sorted
      (largest to smallest).
  
      Complexity O(n^2)
      """
      sizes = zip(items, weight(items, **kwargs))
      sizes = sorted(sizes, key=operator.itemgetter(1), reverse=True)
      items = map(operator.itemgetter(0), sizes)
      return ff(items, targets)