import csv


def check_if_irregular(user_verb):
    """
    Checks if the inputted verb is irregular by loading and checking against a given csv of commonly used irregular verbs.
    If it is an irregular verb, the conjugations accrording to the csv will be printed out.
    If it is not an irregular verb, it will return to the loop in main().
    """

    with open('italian_irregular_verbs.csv') as csvfile:
        csvreader = csv.DictReader(csvfile)
        
        for row in csvreader:
            irregular_verb = row['verb']
            first_singular_irreg = row['1st_sing']
            second_singular_irreg = row['2nd_sing']
            third_singular_irreg = row['3rd_sing']
            first_plural_irreg = row['1st_pl']
            second_plural_irreg = row['2nd_pl']
            third_plural_irreg = row['3rd_pl']

            if user_verb == irregular_verb:
                print(f"""
            
                {user_verb} is an irregular verb!
                
                1st singular I / io: {first_singular_irreg}

                2nd singular you / tu: {second_singular_irreg}

                3rd singular he/she lui/lei: {third_singular_irreg}

                1st plural we / noi: {first_plural_irreg}

                2nd plural you / voi: {second_plural_irreg}

                3rd plural they / loro: {third_plural_irreg}
                """)
                
                return True