def chop_traceback(tb, exclude_prefix=_UNITTEST_RE, exclude_suffix=_SQLA_RE):
 start = 0
 end = (len(tb) - 1)
 while ((start <= end) and exclude_prefix.search(tb[start])):
  start += 1
 while ((start <= end) and exclude_suffix.search(tb[end])):
  end -= 1
 return tb[start:(end + 1)]

def chop_traceback ( tb , exclude_prefix = _UNITTEST_RE , exclude_suffix = _SQLA_RE ) : start = 0 end = ( len ( tb ) - 1 ) while ( ( start <= end ) and exclude_prefix . search ( tb [ start ] ) ) : start += 1 while ( ( start <= end ) and exclude_suffix . search ( tb [ end ] ) ) : end -= 1 return tb [ start : ( end + 1 ) ]
chop extraneous lines off beginning and end of a traceback .