code: def filter_by_type(stmts_in, stmt_type, **kwargs):
      invert = kwargs.get('invert', False)
      logger.info('Filtering %d statements for type %s%s...' %
                  (len(stmts_in), 'not ' if invert else '',
                   stmt_type.__name__))
      if not invert:
          stmts_out = [st for st in stmts_in if isinstance(st, stmt_type)]
      else:
          stmts_out = [st for st in stmts_in if not isinstance(st, stmt_type)]
      logger.info('%d statements after filter...' % len(stmts_out))
      dump_pkl = kwargs.get('save')
      if dump_pkl:
          dump_statements(stmts_out, dump_pkl)
      return stmts_out