noobtus tetris check valid gird position

Can anyone explain for me why we have to do this function. I read the instruction but I can’t figure out why.
Site : noobtuts - Unity 2D Tetris Tutorial

bool isValidGridPos() {        
    foreach (Transform child in transform) {
        Vector2 v = Grid.roundVec2(child.position);

        // Not inside Border?
        if (!Grid.insideBorder(v))
            return false;

        // Block in grid cell (and not part of same group)?
        if (Grid.grid[(int)v.x, (int)v.y] != null &&
            Grid.grid[(int)v.x, (int)v.y].parent != transform)
            return false;
    }
    return true;
}

As the same tutorial explains, this function check if a piece just spawned is colliding with another block element and if it is then it stops the game (from tutorial: “If a new group was spawned and it immediately collides with something else, then the game is over”).