code: def dlmk(l,m,k,theta1):
      
      
      if m >= k:
          
          factor = sqrt(factorial(l-k)*factorial(l+m)/factorial(l+k)/factorial(l-m))
          part2 = (cos(theta1/2))**(2*l+k-m)*(-sin(theta1/2))**(m-k)/factorial(m-k)
          part3 = sp.hyp2f1(m-l,-k-l,m-k+1,-(tan(theta1/2))**2)
  
          return factor*part2*part3
      
      else:
          
          return (-1)**(m-k) * dlmk(l,k,m,theta1)
docs: returns value of d^l_mk as defined in allen, ottewill 97.
      Called by Dlmk