def load_alpha_square(alphafile):
    """loads the ADFG(V)X matrix from a file

    Args:
        alphafile (str): contents of the matrix file

    Raises:
        ValueError: raised if matrix is not square

    Returns:
        list of list of str: adfgvx translation matrix
    """
    alpha_square = []
    for line in alphafile:
        split_line = [i.strip() for i in line.split(',')]
        alpha_square.append(split_line)

    # make sure matrix is square
    if not all(len(i)==len(alpha_square) for i in alpha_square):
        raise ValueError("Input file is not 5x5 or 6x6")

    return alpha_square