code: def make_binary_tree(fn, args, **kwargs):
      """Takes a function/class that takes two positional arguments and a list of
      arguments and returns a binary tree of results/instances.
  
      >>> make_binary_tree(UnionMatcher, [matcher1, matcher2, matcher3])
      UnionMatcher(matcher1, UnionMatcher(matcher2, matcher3))
  
      Any keyword arguments given to this function are passed to the class
      initializer.
      """
  
      count = len(args)
      if not count:
          raise ValueError("Called make_binary_tree with empty list")
      elif count == 1:
          return args[0]
  
      half = count // 2
      return fn(
          make_binary_tree(fn, args[:half], **kwargs),
          make_binary_tree(fn, args[half:], **kwargs),
          **kwargs,
      )
  
file_path: whoosh/src/whoosh/util/__init__.py
imports: from __future__ import with_statement
  import random, sys, time
  from bisect import insort
  from functools import wraps
  from whoosh.compat import xrange
label_desc: Use image node_id 3 for calling a global function with example usage: make_binary_tree(fn, args) and returns: fn, args