code: def fast_inplace_check(fgraph, inputs):
      """
      Return the variables in inputs that are possible candidate for as inputs of
      inplace operation.
  
      Parameters
      ----------
      inputs : list
          Inputs Variable that you want to use as inplace destination.
  
      """
      Supervisor = pytensor.compile.function.types.Supervisor
      protected_inputs = [
          f.protected
          for f in fgraph._features
          if isinstance(f, Supervisor)
      ]
      protected_inputs = sum(protected_inputs, [])  # flatten the list
      protected_inputs.extend(fgraph.outputs)
  
      inputs = [
          i
          for i in inputs
          if not isinstance(i, Constant)
          and not fgraph.has_destroyers([i])
          and i not in protected_inputs
      ]
      return inputs
  
imports: import itertools
  from collections import OrderedDict, deque
  import pytensor
  from pytensor.configdefaults import config
  from pytensor.graph.basic import Constant
  from pytensor.graph.features import AlreadyThere, Bookkeeper
  from pytensor.graph.utils import InconsistencyError
  from pytensor.misc.ordered_set import OrderedSet
label_desc: Use image node_id 3 for calling a global function with example usage: fast_inplace_check(fgraph, inputs) and returns: inputs