code: def _check_processed_flag(
      obj: Union[torch.Tensor, List[torch.Tensor]]
  ):
      """
      Checks if this gradient tensor (or a list of tensors) has been previously
      used in optimization step.
  
      See Also:
          :meth:`~opacus.optimizers.optimizer._mark_as_processed`
  
      Args:
          x: gradient tensor or a list of tensors
  
      Raises:
          ValueError
              If tensor (or at least one tensor from the list) has attribute
              ``._processed`` previously set by ``_mark_as_processed`` method
      """
  
      if isinstance(obj, torch.Tensor):
          _check_processed_flag_tensor(obj)
      elif isinstance(obj, list):
          for x in obj:
              _check_processed_flag_tensor(x)
  
imports: from __future__ import annotations
  import logging
  from typing import Callable, List, Optional, Union
  import torch
  from opacus.optimizers.utils import params
  from opt_einsum.contract import contract
  from torch import nn
  from torch.optim import Optimizer
label_desc: Use image node_id 3 for calling a global function with example usage: _check_processed_flag(obj) without return types