<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pmag_angle(D1,D2):
 # use this """ finds the angle between lists of two directions D1,D2 """

    D1 = numpy.array(D1)
    if len(D1.shape) > 1:
        D1 = D1[:,0:2] # strip off intensity
    else: D1 = D1[:2]
    D2 = numpy.array(D2)
    if len(D2.shape) > 1:
        D2 = D2[:,0:2] # strip off intensity
    else: D2 = D2[:2]
    X1 = dir2cart(D1) # convert to cartesian from polar
    X2 = dir2cart(D2)
    angles = [] # set up a list for angles
    for k in range(X1.shape[0]): # single vector
        angle = numpy.arccos(numpy.dot(X1[k],X2[k]))*180./numpy.pi # take the dot product
        angle = angle%360.
        angles.append(angle)
    return numpy.array(angles)