code: def public_dir(obj, max_underscores=0, type_=None):
      
  
      if max_underscores > 0:
          cond1 = lambda i: not i.startswith("_" * max_underscores)  # noqa
      else:
          cond1 = lambda i: True  # noqa
      if type_:
          if isinstance(type_, str):
              if type_ in ["callable", "func", "function"]:
                  type_ = Callable
              elif "callable" in type_ or "func" in type_:
                  type_ = [
                      i
                      if i not in ["callable", "func", "function"]
                      else Callable
                      for i in type_
                  ]
          if isinstance(type_, str):
              # 'str' --> str (class `type`)
              type_ = eval(type_)
          elif not isinstance(type_, type):
              type_ = [eval(i) if isinstance(i, str) else i for i in type_]
          # else: we have isinstance(type_, type)
          cond2 = lambda i: isinstance(getattr(obj, i), type_)  # noqa
      else:
          cond2 = lambda i: True  # noqa
      return [i for i in dir(obj) if cond1(i) and cond2(i)]
docs: Like `dir()` with additional options for object inspection.
  
      Attributes
      ----------
      obj: object
          Any object that could be passed to `dir()`
      max_underscores: int, default 0
          If > 0, names that begin with underscores repeated n or more
          times will be excluded.
      type_: None, sequence, str, or type
          Filter to objects of these type(s) only.  if 'callable' or
          'func' is passed, gets mapped to collections.Callable.  if the
          string-version of a type (i.e. 'str') is passed, it gets
          eval'd to its type.
  
      Examples
      --------
      >>> import os
      >>> # Get all public string constants from os.path
          public_dir(os.path, max_underscores=1, type_=str)
      ['curdir', 'defpath', 'devnull', 'extsep', 'pardir', 'pathsep', 'sep']
      >>> # Get integer constants
          public_dir(os.path, max_underscores=1, type_='int')
      ['supports_unicode_filenames']