docs: def get_plugins_directory(config_path=None, microdrop_user_root=None):
      '''
      Resolve plugins directory.
  
      Plugins directory is resolved as follows, highest-priority first:
  
       1. ``plugins`` directory specified in provided :data:`config_path`.
       2. ``plugins`` sub-directory of specified MicroDrop profile path (i.e.,
          :data:`microdrop_user_root`)
       3. ``plugins`` sub-directory of parent directory of configuration file
          path specified using ``MICRODROP_CONFIG`` environment variable.
       4. ``plugins`` sub-directory of MicroDrop profile path specified using
          ``MICRODROP_PROFILE`` environment variable.
       5. Plugins directory specified in
          ``<home directory>/MicroDrop/microdrop.ini``.
       6. Plugins directory in default profile location, i.e.,
          ``<home directory>/MicroDrop/plugins``.
  
      Parameters
      ----------
      config_path : str, optional
          Configuration file path (i.e., path to ``microdrop.ini``).
      microdrop_user_root : str, optional
          Path to MicroDrop user data directory.
  
      Returns
      -------
      path
          Absolute path to plugins directory.
      '''
      RESOLVED_BY_NONE = 'default'
      RESOLVED_BY_CONFIG_ARG = 'config_path argument'
      RESOLVED_BY_PROFILE_ARG = 'microdrop_user_root argument'
      RESOLVED_BY_CONFIG_ENV = 'MICRODROP_CONFIG environment variable'
      RESOLVED_BY_PROFILE_ENV = 'MICRODROP_PROFILE environment variable'
  
      resolved_by = [RESOLVED_BY_NONE]
  
      # # Find plugins directory path #
      if microdrop_user_root is not None:
          microdrop_user_root = path(microdrop_user_root).realpath()
          resolved_by.append(RESOLVED_BY_PROFILE_ARG)
      elif 'MICRODROP_PROFILE' in os.environ:
          microdrop_user_root = path(os.environ['MICRODROP_PROFILE']).realpath()
          resolved_by.append(RESOLVED_BY_PROFILE_ENV)
      else:
          microdrop_user_root = path(home_dir()).joinpath('MicroDrop')
  
      if config_path is not None:
          config_path = path(config_path).expand()
          resolved_by.append(RESOLVED_BY_CONFIG_ARG)
      elif 'MICRODROP_CONFIG' in os.environ:
          config_path = path(os.environ['MICRODROP_CONFIG']).realpath()
          resolved_by.append(RESOLVED_BY_CONFIG_ENV)
      else:
          config_path = microdrop_user_root.joinpath('microdrop.ini')
  
      try:
          # Look up plugins directory stored in configuration file.
          plugins_directory = path(configobj.ConfigObj(config_path)
                                   ['plugins']['directory'])
          if not plugins_directory.isabs():
              # Plugins directory stored in configuration file as relative path.
              # Interpret as relative to parent directory of configuration file.
              plugins_directory = config_path.parent.joinpath(plugins_directory)
          if not plugins_directory.isdir():
              raise IOError('Plugins directory does not exist: {}'
                            .format(plugins_directory))
      except Exception, why:
          # Error looking up plugins directory in configuration file (maybe no
          # plugins directory was listed in configuration file?).
          plugins_directory = microdrop_user_root.joinpath('plugins')
          logger.warning('%s.  Using default plugins directory: %s', why,
                         plugins_directory)
          if resolved_by[-1] in (RESOLVED_BY_CONFIG_ARG, RESOLVED_BY_CONFIG_ENV):
              resolved_by.pop()
      logger.info('Resolved plugins directory by %s: %s', resolved_by[-1],
                  plugins_directory)
      return plugins_directory