def handle_exception(exc, msg='SOMETHING WENT WRONG', xit=SystemExit):
    """
    Print msg, then text of exception exc, then raise exception xit.

    :param exc: Exception to handle.
    :type exc: Exception

    :param msg: Message to raise, "SOMETHING WENT WRONG" by default.
    :type msg: str

    :param xit: Exception to raise upon exit, SystemExit by default.
    :type xit: Exception
    """
    print(msg)
    print(exc)
    if xit is not None:
        raise xit
