class_docstr: An object to manage the profile directory and its resources.
  
  The profile directory is used by all IPython applications, to manage
  configuration, logging and security.
  
  This object knows how to find, create and manage these directories. This
  should be used by any code that wants to handle profiles.
class_docstr_tok: ["An","object","to","manage","the","profile","directory","and","its","resources",".","The","profile","directory","is","used","by","all","IPython","applications",",","to","manage","configuration",",","logging","and","security",".","This","object","knows","how","to","find",",","create","and","manage","these","directories",".","This","should","be","used","by","any","code","that","wants","to","handle","profiles","."]
docstr: Find an existing profile dir by profile name, return its ProfileDir.
  
  This searches through a sequence of paths for a profile dir.  If it
  is not found, a :class:`ProfileDirError` exception will be raised.
  
  The search path algorithm is:
  1. ``py3compat.getcwd()``
  2. ``ipython_dir``
  
  Parameters
  ----------
  ipython_dir : unicode or str
      The IPython directory to use.
  name : unicode or str
      The name of the profile.  The name of the profile directory
      will be "profile_<profile>".
docstr_tok: ["Find","an","existing","profile","dir","by","profile","name",",","return","its","ProfileDir",".","This","searches","through","a","sequence","of","paths","for","a","profile","dir",".","If","it","is","not","found",",","a",":","class",":","`","ProfileDirError","`","exception","will","be","raised",".","The","search","path","algorithm","is",":","1",".","``","py3compat.getcwd","(",")","``","2",".","``","ipython_dir","``","Parameters","--","--","--","--","--","ipython_dir",":","unicode","or","str","The","IPython","directory","to","use",".","name",":","unicode","or","str","The","name","of","the","profile",".","The","name","of","the","profile","directory","will","be","``","profile_","<","profile",">","''","."]
code: def find_profile_dir_by_name(
      cls, ipython_dir, name="default", config=None
  ):
      """Find an existing profile dir by profile name, return its ProfileDir.
  
      This searches through a sequence of paths for a profile dir.  If it
      is not found, a :class:`ProfileDirError` exception will be raised.
  
      The search path algorithm is:
      1. ``py3compat.getcwd()``
      2. ``ipython_dir``
  
      Parameters
      ----------
      ipython_dir : unicode or str
          The IPython directory to use.
      name : unicode or str
          The name of the profile.  The name of the profile directory
          will be "profile_<profile>".
      """
      dirname = "profile_" + name
      paths = [py3compat.getcwd(), ipython_dir]
      for p in paths:
          profile_dir = os.path.join(p, dirname)
          if os.path.isdir(profile_dir):
              return cls(location=profile_dir, config=config)
      else:
          raise ProfileDirError(
              "Profile directory not found in paths: %s" % dirname
          )
  
imports: import os
  import shutil
  import errno
  from traitlets.config.configurable import LoggingConfigurable
  from IPython.paths import get_ipython_package_dir
  from IPython.utils.path import expand_path, ensure_dir_exists
  from IPython.utils import py3compat
  from traitlets import Unicode, Bool, observe
label_desc: Use image node_id 11 for calling the ProfileDir obj's underlying member method code with example usage: obj.find_profile_dir_by_name(cls, ipython_dir, name, config) and returns: cls