def METHOD_NAME(
    job_type: JobType | str = JobType.NORMAL,
    cp2k_cmd: str = SETTINGS.CP2K_CMD,
    max_errors: int = SETTINGS.CP2K_CUSTODIAN_MAX_ERRORS,
    scratch_dir: str = SETTINGS.CUSTODIAN_SCRATCH_DIR,
    handlers: Sequence[ErrorHandler] = _DEFAULT_HANDLERS,
    validators: Sequence[Validator] = _DEFAULT_VALIDATORS,
    cp2k_job_kwargs: dict[str, Any] = None,
    custodian_kwargs: dict[str, Any] = None,
):
    """
    Run CP2K.
    Supports running CP2K with or without custodian (see :obj:`JobType`).
    Parameters
    ----------
    job_type : str or .JobType
        The job type.
    cp2k_cmd : str
        The command used to run cp2k.
    max_errors : int
        The maximum number of errors allowed by custodian.
    scratch_dir : str
        The scratch directory used by custodian.
    handlers : list of .ErrorHandler
        The error handlers used by custodian.
    validators : list of .Validator
        The validators handlers used by custodian.
    wall_time : int
        The maximum wall time. If set, a WallTimeHandler will be added to the list
        of handlers.
    cp2k_job_kwargs : dict
        Keyword arguments that are passed to :obj:`.Cp2kJob`.
    custodian_kwargs : dict
        Keyword arguments that are passed to :obj:`.Custodian`.
    """
    cp2k_job_kwargs = {} if cp2k_job_kwargs is None else cp2k_job_kwargs
    custodian_kwargs = {} if custodian_kwargs is None else custodian_kwargs
    cp2k_cmd = expandvars(cp2k_cmd)
    split_cp2k_cmd = shlex.split(cp2k_cmd)
    if job_type == JobType.DIRECT:
        logger.info(f"Running command: {cp2k_cmd}")
        return_code = subprocess.call(cp2k_cmd, shell=True)
        logger.info(f"{cp2k_cmd} finished running with returncode: {return_code}")
        return
    if job_type == JobType.NORMAL:
        jobs = [Cp2kJob(split_cp2k_cmd, **cp2k_job_kwargs)]
    else:
        raise ValueError(f"Unsupported job type: {job_type}")
    c = Custodian(
        handlers,
        jobs,
        validators=validators,
        max_errors=max_errors,
        scratch_dir=scratch_dir,
        **custodian_kwargs,
    )
    logger.info("Running CP2K using custodian.")
    c.run()