import logging


logger = logging.getLogger(__name__)

def get_title_from_labels(labels: list[str], user_context_labels: list[str] = []) -> str:
    title = "Unknown"
    task_context_labels: list = user_context_labels or DEFAULT_TASK_CONTEXT_LABELS
    for label in labels:
        # TODO We may also want to take a user list of labels instead
        if label in task_context_labels:
            title = label.capitalize()

    if title == "Unknown":
        logger.warning(
            "Missing a prefix and suffix tag for task",
            extra={"labels": labels},
        )
    return title
