def METHOD_NAME(minutes_ago: int = 25, check_pending: bool = False):
    """
    In case the analysis is stuck for whatever reason,
    we should force the status "failed"
    to avoid special exceptions,
    we can just put this function as a cron to cleanup.
    """
    from api_app.models import Job
    logger.info("started check_stuck_analysis")
    query = Q(status=Job.Status.RUNNING.value)
    if check_pending:
        query |= Q(status=Job.Status.PENDING.value)
    difference = now() - datetime.timedelta(minutes=minutes_ago)
    running_jobs = Job.objects.filter(query).filter(
        received_request_time__lte=difference
    )
    logger.info(f"checking if {running_jobs.count()} jobs are stuck")
    jobs_id_stuck = []
    for running_job in running_jobs:
        logger.error(
            f"found stuck analysis, job_id:{running_job.id}."
            f"Setting the job to status to {Job.Status.FAILED.value}'"
        )
        jobs_id_stuck.append(running_job.id)
        running_job.status = Job.Status.FAILED.value
        running_job.finished_analysis_time = now()
        running_job.process_time = running_job.calculate_process_time()
        running_job.save(
            update_fields=["status", "finished_analysis_time", "process_time"]
        )
    logger.info("finished check_stuck_analysis")
    return jobs_id_stuck