Sorry, we can remove the entire if-else condition there. The piece of code mimics lpmn function of basic.py.  
in which, in the interval (-1, 1),  Ferrer's function of the first kind is returned. The phase convention used for the intervals (1, inf) and (-inf, -1) is such that the result is always real.
But the value at boundary condition (1,-1) is the same for both the functions, and the absolute value of input <=1.