docs: def K_branch_diverging_Crane(D_run, D_branch, Q_run, Q_branch, angle=90):
      r'''Returns the loss coefficient for the branch of a diverging tee or wye
      according to the Crane method [1]_.
      
      .. math::
          K_{branch} = G\left[1 + H\left(\frac{Q_{branch}}{Q_{comb}
          \beta_{branch}^2}\right)^2 - J\left(\frac{Q_{branch}}{Q_{comb}
          \beta_{branch}^2}\right)\cos\theta\right]
              
      .. math::
          \beta_{branch} = \frac{D_{branch}}{D_{comb}}
      
      See the notes for definitions of H, J, and G.
  
      Parameters
      ----------
      D_run : float
          Diameter of the straight-through inlet portion of the tee or wye [m]
      D_branch : float
          Diameter of the pipe attached at an angle to the straight-through, [m]
      Q_run : float
          Volumetric flow rate in the straight-through outlet of the tee or wye,
          [m^3/s]
      Q_branch : float
          Volumetric flow rate in the pipe attached at an angle to the straight-
          through, [m^3/s]
      angle : float, optional
          Angle the branch makes with the straight-through (tee=90, wye<90)
          [degrees]
  
      Returns
      -------
      K : float
          Loss coefficient of branch with respect to the velocity and inside 
          diameter of the combined flow inlet [-]
  
      Notes
      -----
      If :math:`\beta_{branch} = 1, \theta = 90^\circ`, H = 0.3 and J = 0. 
      Otherwise H = 1 and J = 2.
      
      G is determined according to the following pseudocode:
          
      .. code-block:: python
      
          if angle < 75:
              if beta2 <= 0.35:
                  if Q_ratio <= 0.4:
                      G = 1.1 - 0.7*Q_ratio
                  else:
                      G = 0.85
              else:
                  if Q_ratio <= 0.6:
                      G = 1.0 - 0.6*Q_ratio
                  else:
                      G = 0.6
          else:
              if beta2 <= 2/3.:
                  G = 1
              else:
                  G = 1 + 0.3*Q_ratio*Q_ratio
  
      Note that there are several errors in the text of [1]_; the errata can be  
      obtained here: http://www.flowoffluids.com/publications/tp-410-errata.aspx
  
      Examples
      --------
      Example 7-36 of [1]_. A DN150 schedule 80 wye has 1515 liters/minute of
      water exiting the straight leg, and 950 liters/minute of water
      exiting it through a 45° branch. Calculate the loss coefficient in
      the branch. The calculated value there is 0.4640.
      
      >>> K_branch_diverging_Crane(0.146, 0.146, 0.02525, 0.01583, angle=45)
      0.4639895627496694
      
      References
      ----------
      .. [1] Crane Co. Flow of Fluids Through Valves, Fittings, and Pipe. Crane,
         2009.
      '''
      beta = (D_branch/D_run)
      beta2 = beta*beta
      Q_comb = Q_run + Q_branch
      Q_ratio = Q_branch/Q_comb
  
      if angle < 60 or beta <= 2/3.:
          H, J = 1., 2.
      else:
          H, J = 0.3, 0
      if angle < 75:
          if beta2 <= 0.35:
              if Q_ratio <= 0.4:
                  G = 1.1 - 0.7*Q_ratio
              else:
                  G = 0.85
          else:
              if Q_ratio <= 0.6:
                  G = 1.0 - 0.6*Q_ratio
              else:
                  G = 0.6
      else:
          if beta2 <= 2/3.:
              G = 1
          else:
              G = 1 + 0.3*Q_ratio*Q_ratio
      angle_rad = radians(angle)
      K_branch = G*(1 + H*(Q_ratio/beta2)**2 - J*(Q_ratio/beta2)*cos(angle_rad))
      return K_branch