code: def cut_model(model, cut):
      "Cut an instantiated model"
      if isinstance(cut, int):
          return nn.Sequential(*list(model.children())[:cut])
      elif callable(cut):
          return cut(model)
      raise NameError("cut must be either integer or a function")
  
imports: from __future__ import annotations
  from packaging.version import parse
  from ..basics import *
  from .core import *
  from .data import *
  from .augment import *
  from .None import models
  import torchvision
  from ..callback.hook import num_features_model
label_desc: Use image node_id 6 for calling a global function with example usage: cut_model(model, cut) and returns: nn, cut