code: def create_body(arch:Callable, pretrained:bool=True, cut:Optional[Union[int, Callable]]=None):
      "Cut off the body of a typically pretrained `model` at `cut` (int) or cut the model as specified by `cut(model)` (function)."
      model = arch(pretrained)
      cut = ifnone(cut, cnn_config(arch)['cut'])
      if cut is None:
          ll = list(enumerate(model.children()))
          cut = next(i for i,o in reversed(ll) if has_pool_type(o))
      if   isinstance(cut, int):      return nn.Sequential(*list(model.children())[:cut])
      elif isinstance(cut, Callable): return cut(model)
      else:                           raise NamedError("cut must be either integer or a function"f create_body(arch:Callable, pretrained:bool=True, cut:Optional[Union[int, Callable]]=None):
      "Cut off the body of a typically pretrained `model` at `cut` (int) or cut the model as specified by `cut(model)` (function)."
      model = arch(pretrained)
      cut = ifnone(cut, cnn_config(arch)['cut'])
      if cut is None:
          ll = list(enumerate(model.children()))
          cut = next(i for i,o in reversed(ll) if has_pool_type(o))
      if   isinstance(cut, int):      return nn.Sequential(*list(model.children())[:cut])
      elif isinstance(cut, Callable): return cut(model)
      else:                           raise NamedError("cut must be either integer or a function")
docs: Cut off the body of a typically pretrained `model` at `cut` (int) or cut the model as specified by `cut(model)` (function).