input: Write a python function to print a binary tree in a horizontal manner.
  assert print_tree([1, 2, 3, 4, 5]) == """
        1
      2   3
     4 5
  """
  assert print_tree([10, 20, 30, 40, 50, 60, 70]) == """
          10
      20      30
    40  50   60  70
  """
output: def print_tree(tree):
      if not tree:
          return ""
      
      from math import log2, ceil
      import collections
  
      def get_levels(tree):
          levels = []
          level = 0
          while 2 ** level - 1 < len(tree):
              levels.append(tree[2 ** level - 1:2 ** (level + 1) - 1])
              level += 1
          return levels
  
      def format_level(level, max_width):
          count = len(level)
          if count == 0:
              return ""
          spacing = max_width // count
          result = " " * ((spacing - 1) // 2)
          result += (" " * (spacing - 1)).join(str(x) for x in level)
          return result
  
      levels = get_levels(tree)
      max_width = 2 ** (len(levels) - 1) * 4
  
      result = []
      for level in levels:
          result.append(format_level(level, max_width))
  
      return "\n".join(result)
  
  # Test cases
  print_tree([1, 2, 3, 4, 5])  # Expected output in horizontal tree format
  print_tree([10, 20, 30, 40, 50, 60, 70])  # Expected output in horizontal tree format