def trim_line(line, column=0):
 line = line.strip(u'\n')
 ll = len(line)
 if (ll <= 150):
  return line
 if (column > ll):
  column = ll
 start = max((column - 60), 0)
 if (start < 5):
  start = 0
 end = min((start + 140), ll)
 if (end > (ll - 5)):
  end = ll
 if (end == ll):
  start = max((end - 140), 0)
 line = line[start:end]
 if (end < ll):
  line += u' {snip}'
 if (start > 0):
  line = (u'{snip} ' + line)
 return line

def trim_line ( line , column = 0 ) : line = line . strip ( u'\n' ) ll = len ( line ) if ( ll <= 150 ) : return line if ( column > ll ) : column = ll start = max ( ( column - 60 ) , 0 ) if ( start < 5 ) : start = 0 end = min ( ( start + 140 ) , ll ) if ( end > ( ll - 5 ) ) : end = ll if ( end == ll ) : start = max ( ( end - 140 ) , 0 ) line = line [ start : end ] if ( end < ll ) : line += u' {snip}' if ( start > 0 ) : line = ( u'{snip} ' + line ) return line
trims a line down to a goal of 140 characters .