code: def filter_grounded_only(stmts_in, **kwargs):
      remove_bound = kwargs.get('remove_bound', False)
      logger.info('Filtering %d statements for grounded agents...' % 
                  len(stmts_in))
      stmts_out = []
      score_threshold = kwargs.get('score_threshold')
      for st in stmts_in:
          grounded = True
          for agent in st.agent_list():
              if agent is not None:
                  criterion = lambda x: _agent_is_grounded(x, score_threshold)
                  if not criterion(agent):
                      grounded = False
                      break
                  if not isinstance(agent, Agent):
                      continue
                  if remove_bound:
                      _remove_bound_conditions(agent, criterion)
                  elif _any_bound_condition_fails_criterion(agent, criterion):
                      grounded = False
                      break
          if grounded:
              stmts_out.append(st)
      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