code: def replace_activations(self, linked_stmts=None):
          
          if linked_stmts is None:
              linked_stmts = self.infer_activations(self.statements)
          new_stmts = []
          for stmt in self.statements:
              if not isinstance(stmt, RegulateActivity):
                  new_stmts.append(stmt)
                  continue
              found = False
              for linked_stmt in linked_stmts:
                  inferred_stmt = linked_stmt.inferred_stmt
                  if stmt.is_activation == inferred_stmt.is_activation and \
                      stmt.subj.entity_matches(inferred_stmt.subj) and \
                      stmt.obj.entity_matches(inferred_stmt.obj):
                          found = True
              if not found:
                  new_stmts.append(stmt)
              else:
                  logger.info('Removing regulate activity: %s' % stmt)
          self.statements = new_stmts
docs: Remove RegulateActivity Statements that can be inferred out.
  
          This function iterates over self.statements and looks for
          RegulateActivity Statements that either match or are refined by
          inferred RegulateActivity Statements that were linked
          (provided as the linked_stmts argument).
          It removes RegulateActivity Statements from self.statements that can be
          explained by the linked statements.
  
          Parameters
          ----------
          linked_stmts : Optional[list[indra.mechlinker.LinkedStatement]]
              A list of linked statements, optionally passed from outside.
              If None is passed, the MechLinker runs self.infer_activations to
              infer RegulateActivities and obtain a list of LinkedStatements
              that are then used for removing existing Complexes
              in self.statements.