def calculate_score(positive_detections: int, classification: str, threshold: int, anti_virus: int = 0) -> int:
    """
    Calculates Demisto score based on the classification of Maltiverse and number of positive detections in the blacklist.

    Args:
        positive_detections (int): the number of items in the blacklist
        classification (str): the classification given to the IoC by Maltiverse. Can be one of: neutral, whitelist,
        suspicious, malicious
        threshold (int): the score threshold configured by the user.
        anti_virus (int) - optional: used to calculate the score only in the case that the IoC is a file. Indicates the
        number of items in the list of antivirus detections.

    Returns:
        int - Demisto's score for the indicator
    """
    if positive_detections == 0 and classification == 'neutral':
        return 0
    elif classification == 'whitelist':
        return 1
    elif positive_detections <= threshold and classification != 'malicious':
        if anti_virus > 1:
            return 3
        return 2
    elif positive_detections > threshold or classification == 'malicious':
        return 3
    else:  # if reached this line there is a problem with the logic
        return -1