ENH: associated Legendre function of second kind with types 2 and 3

This PR replaces #3903  where I was unable to resolve a merge conflict going back to 090b85d which I have resolved here. All changes of #3903 have been applied here to a recent version of upstream/master so that the present version corresponds to a0e7f51 discussed in #3903 as far as the associated Legendre function of second kind is concerned.