returns a pair of library mappings, the first mapping library uri to a
     library name for all libraries in the production folder, and the second
     mapping library name to info for libraries in the production folder with
     parsable versions

    Parameters
    ----------
    logger: logging object
        configured in cli_commands.py
    prod_folder: string
        name of folder in Databricks UI containing production libraries
    token: string
        Databricks API key
    host: string
        Databricks account url
        (e.g. https://fake-organization.cloud.databricks.com)

    Returns
    -------
    dictionary mapping a library uri to a library name
    dictionary mapping library UI path to base name, major version,
        minor version, and id number

def get_library_mapping(logger, prod_folder, token, host):
    """
    returns a pair of library mappings, the first mapping library uri to a
     library name for all libraries in the production folder, and the second
     mapping library name to info for libraries in the production folder with
     parsable versions

    Parameters
    ----------
    logger: logging object
        configured in cli_commands.py
    prod_folder: string
        name of folder in Databricks UI containing production libraries
    token: string
        Databricks API key
    host: string
        Databricks account url
        (e.g. https://fake-organization.cloud.databricks.com)

    Returns
    -------
    dictionary mapping a library uri to a library name
    dictionary mapping library UI path to base name, major version,
        minor version, and id number
    """
    res = requests.get(
        host + '/api/1.2/libraries/list',
        auth=('token', token),
    )
    if res.status_code == 200:
        library_list = res.json()
        library_map = {}
        id_nums = {}
        for library in library_list:
            status_res = (
                requests
                .get(
                    host + '/api/1.2/libraries/status?libraryId={}'
                    .format(library['id']),
                    auth=('token', token),
                )
            )
            if status_res.status_code == 200:
                library_info = status_res.json()
                # only do any of this for libraries in the production folder
                if library_info['folder'] != prod_folder:
                    logger.debug(
                        'excluded folder: {} in {}, not prod folder ({})'
                        .format(
                            library_info['name'],
                            library_info['folder'],
                            prod_folder,
                        )
                    )
                    continue
                if library_info['libType'] == 'python-egg':
                    full_name = library_info['name'] + '.egg'
                elif library_info['libType'] == 'java-jar':
                    full_name = library_info['name'] + '.jar'
                else:
                    logger.debug(
                        'excluded library type: {} is of libType {}, '
                        'not jar or egg'
                        .format(
                            library_info['name'],
                            library_info['libType'],
                        )
                    )
                    continue
                try:
                    name_match = FileNameMatch(full_name)
                    # map uri to name match object
                    library_map[library_info['files'][0]] = name_match
                    # map name to name match object and id number
                    # we'll need the id number to clean up old libraries
                    id_nums[library_info['name']] = {
                        'name_match': name_match,
                        'id_num': library_info['id'],
                    }
                except FileNameError:
                    logger.debug(
                        'FileNameError: {} file name is not parsable'
                        .format(full_name)
                    )
                    pass
            else:
                raise APIError(status_res)
        return library_map, id_nums
    else:
        raise APIError(res)