docs: def best_representative(d1, d2):
      """
      Given two objects each coerced to the most specific type possible, return the one
      of the least restrictive type.
  
      >>> best_representative(Decimal('-37.5'), Decimal('0.9999'))
      Decimal('-99.9999')
      >>> best_representative(None, Decimal('6.1'))
      Decimal('6.1')
      >>> best_representative(311920, '48-49')
      '48-490'
      >>> best_representative(6, 'foo')
      'foo'
      >>> best_representative(Decimal('4.95'), Decimal('6.1'))
      Decimal('9.99')
      >>> best_representative(Decimal('-1.9'), Decimal('6.1'))
      Decimal('-9.9')
      """
    
      if hasattr(d2, 'strip') and not d2.strip():
          return d1
      if d1 is None:
          return d2
      elif d2 is None:
          return d1
      preference = (datetime.datetime, bool, int, Decimal, float, str)
      worst_pref = 0
      worst = ''
      for coerced in (d1, d2):
          pref = preference.index(type(coerced))
          if pref > worst_pref:
              worst_pref = pref
              worst = set_worst(worst, coerced)
          elif pref == worst_pref:
              if isinstance(coerced, Decimal):
                  worst = set_worst(worst, worst_decimal(coerced, worst))
              elif isinstance(coerced, float):
                  worst = set_worst(worst, max(coerced, worst))
              else:  # int, str
                  if len(str(coerced)) > len(str(worst)):
                      worst = set_worst(worst, coerced)
      return worst