code: def filter_inconsequential_mods(stmts_in, whitelist=None, **kwargs):
      if whitelist is None:
          whitelist = {}
      logger.info('Filtering %d statements to remove' % len(stmts_in) +
                  ' inconsequential modifications...')
      states_used = whitelist
      for stmt in stmts_in:
          for agent in stmt.agent_list():
              if agent is not None:
                  if agent.mods:
                      for mc in agent.mods:
                          mod = (mc.mod_type, mc.residue, mc.position)
                          try:
                              states_used[agent.name].append(mod)
                          except KeyError:
                              states_used[agent.name] = [mod]
      for k, v in states_used.items():
          states_used[k] = list(set(v))
      stmts_out = []
      for stmt in stmts_in:
          skip = False
          if isinstance(stmt, Modification):
              mod_type = modclass_to_modtype[stmt.__class__]
              if isinstance(stmt, RemoveModification):
                  mod_type = modtype_to_inverse[mod_type]
              mod = (mod_type, stmt.residue, stmt.position)
              used = states_used.get(stmt.sub.name, [])
              if mod not in used:
                  skip = True
          if not skip:
              stmts_out.append(stmt)
      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