code: def most_unstable_parcel(pressure, temperature, dewpoint, heights=None,
                           bottom=None, depth=300 * units.hPa):
      
      p_layer, t_layer, td_layer = get_layer(pressure, temperature, dewpoint, bottom=bottom,
                                             depth=depth, heights=heights, interpolate=False)
      theta_e = equivalent_potential_temperature(p_layer, t_layer, td_layer)
      max_idx = np.argmax(theta_e)
      return p_layer[max_idx], t_layer[max_idx], td_layer[max_idx], max_idx
docs: Determine the most unstable parcel in a layer.
  
      Determines the most unstable parcel of air by calculating the equivalent
      potential temperature and finding its maximum in the specified layer.
  
      Parameters
      ----------
      pressure: `pint.Quantity`
          Atmospheric pressure profile
      temperature: `pint.Quantity`
          Atmospheric temperature profile
      dewpoint: `pint.Quantity`
          Atmospheric dewpoint profile
      heights: `pint.Quantity`, optional
          Atmospheric height profile. Standard atmosphere assumed when None (the default).
      bottom: `pint.Quantity`, optional
          Bottom of the layer to consider for the calculation in pressure or height.
          Defaults to using the bottom pressure or height.
      depth: `pint.Quantity`, optional
          Depth of the layer to consider for the calculation in pressure or height. Defaults
          to 300 hPa.
  
      Returns
      -------
      `pint.Quantity`
          Pressure, temperature, and dew point of most unstable parcel in the profile.
      integer
          Index of the most unstable parcel in the given profile
  
      See Also
      --------
      get_layer