ENH: Refactored the lbfgsb module for extended compatibility with previous scipy versions