def METHOD_NAME(title, label, title_prefixes, label_paths):
    """Detects necessary labels based on the title structure
    :return: list of labels
    """
    labels = []
    for title_prefix in title_prefixes:
        try:
            if title_prefix == "Snyk" and title_prefix in title:
                labels.append(label)
            # Detect title prefix i.e feat, fix, refactor..etc
            if title_prefix in title.split(':')[0]:
                print(f"Detected label from title prefix. Adding label {label}")
                labels.append(label)
        except Exception as e:
            print(e)
    # Detect comp-* label from component name in title
    component = title[title.find("(") + 1: title.find(")")]
    for path in label_paths:
        try:
            if component == path:
                print(f"Detected label from title component {path}. Adding label {label}")
                labels.append(label)
        except Exception as e:
            print(e)
    return labels