def METHOD_NAME(
    entries: List[Dict[str, Any]],
    task_type: TaskType,
    sort_by: Optional[Callable] = None,
) -> List[Dict[str, Any]]:
    """
    Filter (and sort) TaskDocument entries based on task type
    :param entries: List of TaskDocument entry dicts
    :param TaskType: TaskType to accept
    :param sort_by: Function used to sort (default None)
    :return: Filtered (sorted) list of entries
    """
    filtered = [f for f in entries if f["task_type"] == task_type]
    if sort_by is not None:
        return sorted(filtered, key=sort_by)
    else:
        return filtered