def recursive_search(event, lst, list_pointer, list_len):
    """Retrieve events from nested dict.

    Used to check if values in the template exists inside the event dictionary

    Parameters
    ----------
    event : {dict}
        Dictionary of the JSON response from ESM
    lst : {string}
        Configuration value in template.conf
    list_pointer : {int}
        Keeping track of where we are in the iteration
    list_len : {int}
        Total length of nesting inside the dict

    Returns
    -------
    [string]
        Returns the value stored in dict, or False if failing

    """
    if list_pointer == list_len:
        return event
    for k, v in event.items():
        if k == lst[list_pointer]:
            return recursive_search(v, lst, list_pointer + 1, list_len)
    return False