Update lsm.py

updated lsm class with latest corrected code