```python
def magic_square_test(my_matrix):
    """
    Tests if a given matrix is a magic square.

    A magic square is a square grid where the sum of the numbers in each row,
    each column, and both main diagonals is the same.
    """
    # A magic square must be a non-empty square.
    if not my_matrix:
        return False

    num_rows = len(my_matrix)
    
    # Check if all rows have a length equal to the number of rows.
    # This ensures the matrix is square.
    for row in my_matrix:
        if len(row) != num_rows:
            return False
    
    # A 0x0 matrix is not considered a magic square in this context.
    if num_rows == 0:
        return False

    size = num_rows

    # Calculate the target sum from the first row.
    magic_sum = sum(my_matrix[0])

    # Check if the sum of each row is equal to the magic sum.
    for row in my_matrix:
        if sum(row) != magic_sum:
            return False

    # Check if the sum of each column is equal to the magic sum.
    for col_index in range(size):
        column_sum = 0
        for row_index in range(size):
            column_sum += my_matrix[row_index][col_index]
        if column_sum != magic_sum:
            return False

    # Check if the sum of the main diagonal (top-left to bottom-right) is equal.
    main_diagonal_sum = 0
    for i in range(size):
        main_diagonal_sum += my_matrix[i][i]
    if main_diagonal_sum != magic_sum:
        return False

    # Check if the sum of the anti-diagonal (top-right to bottom-left) is equal.
    anti_diagonal_sum = 0
    for i in range(size):
        anti_diagonal_sum += my_matrix[i][size - 1 - i]
    if anti_diagonal_sum != magic_sum:
        return False

    # If all conditions are met, it is a magic square.
    return True
```