class_docstr: A helper for constructing the namespace open and close strings for a nested set of namespaces.
  
  e.g. for namespace_str torch::lazy,
  
  prologue:
  namespace torch {
  namespace lazy {
  
  epilogue:
  } // namespace lazy
  } // namespace torch
class_docstr_tok: ["A","helper","for","constructing","the","namespace","open","and","close","strings","for","a","nested","set","of","namespaces",".","e.g",".","for","namespace_str","torch",":",":lazy",",","prologue",":","namespace","torch","{","namespace","lazy","{","epilogue",":","}","\/\/","namespace","lazy","}","\/\/","namespace","torch"]
docstr: Generate helper from nested namespaces as long as class/function name. E.g.: "torch::lazy::add"
code: def from_namespaced_entity(
      namespaced_entity: str, max_level: int = 2
  ) -> "NamespaceHelper":
      """
      Generate helper from nested namespaces as long as class/function name. E.g.: "torch::lazy::add"
      """
      names = namespaced_entity.split("::")
      entity_name = names[-1]
      namespace_str = "::".join(names[:-1])
      return NamespaceHelper(
          namespace_str=namespace_str,
          entity_name=entity_name,
          max_level=max_level,
      )
  
imports: import contextlib
  import functools
  import hashlib
  import os
  import re
  import sys
  import textwrap
  from argparse import Namespace
  from dataclasses import fields, is_dataclass
  from enum import auto, Enum
  from typing import Any, Callable, Dict, Generic, Iterable, Iterator, List, Literal, NoReturn, Optional, Sequence, Set, Tuple, TypeVar, Union
  from typing_extensions import Self
  from torchgen.code_template import CodeTemplate
label_desc: Use image node_id 2 for calling the NamespaceHelper obj's underlying member method code with example usage: obj.from_namespaced_entity(namespaced_entity, max_level) and returns: NamespaceHelper