def get_plugins_directory(config_path=None, microdrop_user_root=None):
RESOLVED_BY_NONE = '<STR_LIT:default>'<EOL>RESOLVED_BY_CONFIG_ARG = '<STR_LIT>'<EOL>RESOLVED_BY_PROFILE_ARG = '<STR_LIT>'<EOL>RESOLVED_BY_CONFIG_ENV = '<STR_LIT>'<EOL>RESOLVED_BY_PROFILE_ENV = '<STR_LIT>'<EOL>resolved_by = [RESOLVED_BY_NONE]<EOL>if microdrop_user_root is not None:<EOL><INDENT>microdrop_user_root = path(microdrop_user_root).realpath()<EOL>resolved_by.append(RESOLVED_BY_PROFILE_ARG)<EOL><DEDENT>elif '<STR_LIT>' in os.environ:<EOL><INDENT>microdrop_user_root = path(os.environ['<STR_LIT>']).realpath()<EOL>resolved_by.append(RESOLVED_BY_PROFILE_ENV)<EOL><DEDENT>else:<EOL><INDENT>microdrop_user_root = path(home_dir()).joinpath('<STR_LIT>')<EOL><DEDENT>if config_path is not None:<EOL><INDENT>config_path = path(config_path).expand()<EOL>resolved_by.append(RESOLVED_BY_CONFIG_ARG)<EOL><DEDENT>elif '<STR_LIT>' in os.environ:<EOL><INDENT>config_path = path(os.environ['<STR_LIT>']).realpath()<EOL>resolved_by.append(RESOLVED_BY_CONFIG_ENV)<EOL><DEDENT>else:<EOL><INDENT>config_path = microdrop_user_root.joinpath('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>plugins_directory = path(configobj.ConfigObj(config_path)<EOL>['<STR_LIT>']['<STR_LIT>'])<EOL>if not plugins_directory.isabs():<EOL><INDENT>plugins_directory = config_path.parent.joinpath(plugins_directory)<EOL><DEDENT>if not plugins_directory.isdir():<EOL><INDENT>raise IOError('<STR_LIT>'<EOL>.format(plugins_directory))<EOL><DEDENT><DEDENT>except Exception as why:<EOL><INDENT>plugins_directory = microdrop_user_root.joinpath('<STR_LIT>')<EOL>logger.warning('<STR_LIT>', why,<EOL>plugins_directory)<EOL>if resolved_by[-<NUM_LIT:1>] in (RESOLVED_BY_CONFIG_ARG, RESOLVED_BY_CONFIG_ENV):<EOL><INDENT>resolved_by.pop()<EOL><DEDENT><DEDENT>logger.info('<STR_LIT>', resolved_by[-<NUM_LIT:1>],<EOL>plugins_directory)<EOL>return plugins_directory<EOL>
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.