<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def moist_static_energy(heights, temperature, specific_humidity):
 r"""Calculate the moist static energy of parcels. This function will calculate the moist static energy following equation 3.72 in [Hobbs2006]_. Notes ----- .. math::\text{moist static energy} = c_{pd} * T + gz + L_v q * :math:`T` is temperature * :math:`z` is height * :math:`q` is specific humidity Parameters heights : array-like Atmospheric height temperature : array-like Atmospheric temperature specific_humidity : array-like Atmospheric specific humidity Returns ------- `pint.Quantity` The moist static energy """

    return (dry_static_energy(heights, temperature)
            + mpconsts.Lv * specific_humidity.to('dimensionless')).to('kJ/kg')