<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_block_data(self, mat, block):
 """Retrieve a block from a 3D or 4D volume Parameters mat: a 3D or 4D volume block: a tuple containing block information: - a triple containing the lowest-coordinate voxel in the block - a triple containing the size in voxels of the block Returns ------- In the case of a 3D array, a 3D subarray at the block location In the case of a 4D array, a 4D subarray at the block location, including the entire fourth dimension. """

        (pt, sz) = block
        if len(mat.shape) == 3:
            return mat[pt[0]:pt[0]+sz[0],
                       pt[1]:pt[1]+sz[1],
                       pt[2]:pt[2]+sz[2]].copy()
        elif len(mat.shape) == 4:
            return mat[pt[0]:pt[0]+sz[0],
                       pt[1]:pt[1]+sz[1],
                       pt[2]:pt[2]+sz[2],
                       :].copy()