code: def clip_lp_norms(
      x: ep.Tensor, *, norm: float, p: float
  ) -> ep.Tensor:
      assert 0 < p < ep.inf
      norms = flatten(x).norms.lp(p=p, axis=-1)
      norms = ep.maximum(norms, 1e-12)  # avoid divsion by zero
      factor = ep.minimum(
          1, norm / norms
      )  # clipping -> decreasing but not increasing
      factor = atleast_kd(factor, x.ndim)
      return x * factor
  
imports: from typing import Union, Any, Optional, Callable, Tuple
  from abc import ABC, abstractmethod
  import eagerpy
  from ..devutils import flatten
  from ..devutils import atleast_kd
  from ..types import Bounds
  from ..models.base import Model
  from ..criteria import Misclassification, TargetedMisclassification
  from ..distances import l1, l2, linf
  from .base import FixedEpsilonAttack
  from .base import T
  from .base import get_criterion
  from .base import raise_if_kwargs
  from .base import verify_input_bounds
label_desc: Use image node_id 1 for calling a global function with example usage: clip_lp_norms(x) and returns: unknown