<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def div_filter(key: str, value: list, format: str, meta: Any) -> Optional[list]: """Filter the JSON ``value`` for alert divs. Arguments --------- key Key of the structure value Values in the structure format Output format of the processing meta Meta information """

    if key != "Div" or format != "latex":
        return None

    [[_, classes, _], contents] = value
    try:
        alert_type = [name.split("-")[1] for name in classes if "-" in name][0]
    except IndexError:
        return None

    if alert_type not in ALLOWED_ALERT_TYPES.__members__:
        return None

    filtered = [RawBlock("latex", rf"\begin{{{alert_type}box}}")]
    filtered.extend(contents)
    filtered.append(RawBlock("latex", rf"\end{{{alert_type}box}}"))
    return filtered