def calculate_rarity(row, attribute_types):
    """Helper function to calculate rarity for each row in a pandas dataframe.
       Uses rarity.tools scoring

    Args:
        row ([pandas row]): row of a pandas dataframe
        attribute_types ([list]): list of attributes for the nft collection

    Returns:
        [int]: Rarity score for the nft
    """
    score = 0
    for attribute in attribute_types:
        score = score + 1 / row[f"{attribute}_probability"]
    return score