<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def chi_perp_from_mass1_mass2_xi2(mass1, mass2, xi2):
 """Returns the in-plane spin from mass1, mass2, and xi2 for the secondary mass. """

    q = q_from_mass1_mass2(mass1, mass2)
    a1 = 2 + 3 * q / 2
    a2 = 2 + 3 / (2 * q)
    return q**2 * a2 / a1 * xi2