def cut_lines(pre, post=0, what=None):
 def process(app, what_, name, obj, options, lines):
  if (what and (what_ not in what)):
   return
  del lines[:pre]
  if post:
   if (lines and (not lines[(-1)])):
    lines.pop((-1))
   del lines[(- post):]
  if (lines and lines[(-1)]):
   lines.append('')
 return process

def cut_lines ( pre , post = 0 , what = None ) : def process ( app , what_ , name , obj , options , lines ) : if ( what and ( what_ not in what ) ) : return del lines [ : pre ] if post : if ( lines and ( not lines [ ( - 1 ) ] ) ) : lines . pop ( ( - 1 ) ) del lines [ ( - post ) : ] if ( lines and lines [ ( - 1 ) ] ) : lines . append ( '' ) return process
return a listener that removes the first *pre* and last *post* lines of every docstring .