readability only

use tty.LFLAGS instead of magic attrs[3] bit. Also rename 'attrs' references to 'mode' to match python standard module naming conv.