def ask_confirmation(message, yes = 'y', no = 'n', default = False):
        """
        Ask user to confirm something. Ask again if answer other than expected.

        Arguments:
        - message (string): message to print (e.g. "Are you sure?")
        - yes (string): expected value if user confirms
        - no (string): expceted value if user denies
        - default (bool): value to return if user hits Enter

        Return (bool):
        - True if user types string same as argument yes
        - False if user types string same as argument no
        - default value if user doesn't type anything and hit Enter

        Example:
        ask_confirmation("Are you sure?", "yes", "no", True)
        displays:
        Are you sure? [YES/no]:

        Result:
        - if user types no, No, nO, or NO: returns False
        - if user types yes, Yes, YES, or etc.: returns True
        - if user hits Enter (confirms default): returns True
        - if user types anything else, ask again
        """

        if default:
                yes = yes.upper()
                no = no.lower()
        else:
                yes = yes.lower()
                no = no.upper()
                
        long_message = message + " [" + yes + "/" + no + "]: "
        answer = input(long_message).lower()

        if answer == yes.lower():
                return True
        elif answer == no.lower():
                return False
        elif answer == '':
                return default
        else:
                return ask_confirmation(message, yes, no, default)