Query available plugin packages based on specified Conda channels.

    Parameters
    ----------
    *args
        Extra arguments to pass to Conda ``search`` command.

    Returns
    -------
    dict
        .. versionchanged:: 0.24
            All Conda packages beginning with ``microdrop.`` prefix from all
            configured channels.

        Each *key* corresponds to a package name.

        Each *value* corresponds to a ``list`` of dictionaries, each
        corresponding to an available version of the respective package.

        For example:

            {
              "microdrop.dmf-device-ui-plugin": [
                ...
                {
                  ...
                  "build_number": 0,
                  "channel": "microdrop-plugins",
                  "installed": true,
                  "license": "BSD",
                  "name": "microdrop.dmf-device-ui-plugin",
                  "size": 62973,
                  "version": "2.1.post2",
                  ...
                },
                ...],
                ...
            }

def available_packages(*args, **kwargs):
    '''
    Query available plugin packages based on specified Conda channels.

    Parameters
    ----------
    *args
        Extra arguments to pass to Conda ``search`` command.

    Returns
    -------
    dict
        .. versionchanged:: 0.24
            All Conda packages beginning with ``microdrop.`` prefix from all
            configured channels.

        Each *key* corresponds to a package name.

        Each *value* corresponds to a ``list`` of dictionaries, each
        corresponding to an available version of the respective package.

        For example:

            {
              "microdrop.dmf-device-ui-plugin": [
                ...
                {
                  ...
                  "build_number": 0,
                  "channel": "microdrop-plugins",
                  "installed": true,
                  "license": "BSD",
                  "name": "microdrop.dmf-device-ui-plugin",
                  "size": 62973,
                  "version": "2.1.post2",
                  ...
                },
                ...],
                ...
            }
    '''
    # Get list of available MicroDrop plugins, i.e., Conda packages that start
    # with the prefix `microdrop.`.
    try:
        plugin_packages_info_json = ch.conda_exec('search', '--json',
                                                  '^microdrop\.', verbose=False)
        return json.loads(plugin_packages_info_json)
    except RuntimeError, exception:
        if 'CondaHTTPError' in str(exception):
            logger.warning('Could not connect to Conda server.')
        else:
            logger.warning('Error querying available MicroDrop plugins.',
                           exc_info=True)
    except Exception, exception:
        logger.warning('Error querying available MicroDrop plugins.',
                       exc_info=True)
    return {}