from typing import Optional
import logging


def get_existing_handlers(handlertype) -> Optional[logging.Handler]:
    """
    Returns Existing handler or None (if the handler has not yet been added to the root handlers).
    """
    return next((h for h in logging.root.handlers if isinstance(h, handlertype)), None)