def get_pack_base_path(pack_name, include_trailing_slash=False, use_pack_cache=False):
    """
    Return full absolute base path to the content pack directory.

    Note: This function looks for a pack in all the load paths and return path to the first pack
    which matched the provided name.

    If a pack is not found, we return a pack which points to the first packs directory (this is
    here for backward compatibility reasons).

    :param pack_name: Content pack name.
    :type pack_name: ``str``

    :param include_trailing_slash: True to include trailing slash.
    :type include_trailing_slash: ``bool``

    :param use_pack_cache: True to cache base paths on per-pack basis. This help in situations
                           where this method is called multiple times with the same pack name.
    :type use_pack_cache`` ``bool``

    :rtype: ``str``
    """
    if not pack_name:
        return None

    if use_pack_cache and pack_name in PACK_NAME_TO_BASE_PATH_CACHE:
        return PACK_NAME_TO_BASE_PATH_CACHE[pack_name]

    packs_base_paths = get_packs_base_paths()
    for packs_base_path in packs_base_paths:
        pack_base_path = os.path.join(packs_base_path, quote_unix(pack_name))
        pack_base_path = os.path.abspath(pack_base_path)

        if os.path.isdir(pack_base_path):
            if include_trailing_slash and not pack_base_path.endswith(os.path.sep):
                pack_base_path += os.path.sep

            PACK_NAME_TO_BASE_PATH_CACHE[pack_name] = pack_base_path
            return pack_base_path

    # Path with the provided name not found
    pack_base_path = os.path.join(packs_base_paths[0], quote_unix(pack_name))
    pack_base_path = os.path.abspath(pack_base_path)

    if include_trailing_slash and not pack_base_path.endswith(os.path.sep):
        pack_base_path += os.path.sep

    PACK_NAME_TO_BASE_PATH_CACHE[pack_name] = pack_base_path
    return pack_base_path

    Return full absolute base path to the content pack directory.

    Note: This function looks for a pack in all the load paths and return path to the first pack
    which matched the provided name.

    If a pack is not found, we return a pack which points to the first packs directory (this is
    here for backward compatibility reasons).

    :param pack_name: Content pack name.
    :type pack_name: ``str``

    :param include_trailing_slash: True to include trailing slash.
    :type include_trailing_slash: ``bool``

    :param use_pack_cache: True to cache base paths on per-pack basis. This help in situations
                           where this method is called multiple times with the same pack name.
    :type use_pack_cache`` ``bool``

    :rtype: ``str``
    
st2common/st2common/content/utils.py