docs: def K_ball_valve_Crane(D1, D2, angle, fd=None):
      r'''Returns the loss coefficient for a ball valve as shown in [1]_.
  
      If β = 1:
          
      .. math::
          K = K_1 = K_2 = 3f_d
          
      If β < 1 and θ <= 45°:
          
      .. math::
          K_2 = \frac{K + \sin \frac{\theta}{2} \left[0.8(1-\beta^2) 
          + 2.6(1-\beta^2)^2\right]} {\beta^4}
              
      If β < 1 and θ > 45°:
          
      .. math::
          K_2 = \frac{K + 0.5\sqrt{\sin\frac{\theta}{2}}(1-\beta^2) 
          + (1-\beta^2)^2}{\beta^4}
          
      Parameters
      ----------
      D1 : float
          Diameter of the valve seat bore (must be equal to or smaller than 
          `D2`), [m]
      D2 : float
          Diameter of the pipe attached to the valve, [m]
      angle : float
          Angle formed by the reducer in the valve, [degrees]
      fd : float, optional
          Darcy friction factor calculated for the actual pipe flow in clean 
          steel (roughness = 0.0018 inch) in the fully developed turbulent 
          region; do not specify this to use the original Crane friction factor!,
          [-]
  
      Returns
      -------
      K : float
          Loss coefficient with respect to the pipe inside diameter [-]
  
      Notes
      -----    
      This method is not valid in the laminar regime and the pressure drop will
      be underestimated in those conditions.
  
      Examples
      --------
      >>> K_ball_valve_Crane(.01, .02, 50)
      14.051310974926592
      
      References
      ----------
      .. [1] Crane Co. Flow of Fluids Through Valves, Fittings, and Pipe. Crane,
         2009.
      '''
      if fd is None:
          fd = ft_Crane(D2)
      beta = D1/D2
      K1 = 3*fd
      angle = radians(angle)
      if beta == 1:
          return K1
      else:
          if angle <= pi/4:
              return (K1 + sin(angle/2)*(0.8*(1-beta**2) + 2.6*(1-beta**2)**2))/beta**4
          else:
              return (K1 + 0.5*(sin(angle/2))**0.5 * (1 - beta**2) + (1-beta**2)**2)/beta**4