def get_path(haystack, needle, path=None):
    """Search a nested dictionary for the path to a specific value.
    The value may be a key in a dict or a value in a list.

    :param haystack: nested dictionary to search
    :param needle: string value to search for
    :param path: pre-path
    :return: path to value as list
    """
    if path is None:
        path = []
    if isinstance(haystack, dict):
        if needle in haystack:
            # Value is a key and has children
            path.append(needle)
            return path, True
        for k, v in haystack.items():
            # Value not yet found
            result = get_path(v, needle, path + [k])
            if result is not None:
                return result
    elif isinstance(haystack, list):
        # Value is in a list and does not have children
        if needle in haystack:
            path.append(needle)
            return path, False
    else:
        # Value is not in this path
        return None, None