docs: def discharge_coefficient_to_K(D, Do, C):
      r'''Converts a discharge coefficient to a standard loss coefficient,
      for use in computation of the actual pressure drop of an orifice or other
      device.
  
      .. math::
          K = \left[\frac{\sqrt{1-\beta^4(1-C^2)}}{C\beta^2} - 1\right]^2
          
      Parameters
      ----------
      D : float
          Upstream internal pipe diameter, [m]
      Do : float
          Diameter of orifice at flow conditions, [m]
      C : float
          Coefficient of discharge of the orifice, [-]
  
      Returns
      -------
      K : float
          Loss coefficient with respect to the velocity and density of the fluid
          just upstream of the orifice, [-]
  
      Notes
      -----
      If expansibility is used in the orifice calculation, the result will not
      match with the specified pressure drop formula in [1]_; it can almost
      be matched by dividing the calculated mass flow by the expansibility factor
      and using that mass flow with the loss coefficient. 
      
      Examples
      --------
      >>> discharge_coefficient_to_K(D=0.07366, Do=0.05, C=0.61512)
      5.2314291729754
      
      References
      ----------
      .. [1] American Society of Mechanical Engineers. Mfc-3M-2004 Measurement 
         Of Fluid Flow In Pipes Using Orifice, Nozzle, And Venturi. ASME, 2001.
      .. [2] ISO 5167-2:2003 - Measurement of Fluid Flow by Means of Pressure 
         Differential Devices Inserted in Circular Cross-Section Conduits Running
         Full -- Part 2: Orifice Plates.
      '''
      beta = Do/D
      beta2 = beta*beta
      beta4 = beta2*beta2
      return ((1.0 - beta4*(1.0 - C*C))**0.5/(C*beta2) - 1.0)**2