code: def log_sum_2_exp(a: float, b: float) -> float:
      """Computation of log( (e^a + e^b) / 2) in an overflow-proof way
  
      Parameters
      ----------
      a
          First number
  
      b
          Second number
      """
      # TODO: if |a - b| > 50 skip
      # TODO: try several log and exp implementations
      if a > b:
          return a + math.log((1 + math.exp(b - a)) / 2)
      else:
          return b + math.log((1 + math.exp(a - b)) / 2)
  
imports: from __future__ import annotations
  import functools
  import itertools
  import math
  import operator
  import numpy
  import scipy
label_desc: Use image node_id 16 for calling a global function with example usage: log_sum_2_exp(a, b) and returns: unknown, unknown