<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def matrix2map(data_matrix, map_shape):
 r"""Matrix to Map This method transforms a 2D matrix to a 2D map Parameters data_matrix : np.ndarray Input data matrix, 2D array map_shape : tuple 2D shape of the output map Returns ------- np.ndarray 2D map Raises ------ ValueError For invalid layout Examples -------- [3, 7, 11, 15]]) array([[ 0, 1, 4, 5], [ 2, 3, 6, 7], [ 8, 9, 12, 13], [10, 11, 14, 15]]) """


    map_shape = np.array(map_shape)

    # Get the shape and layout of the images
    image_shape = np.sqrt(data_matrix.shape[0]).astype(int)
    layout = np.array(map_shape // np.repeat(image_shape, 2), dtype='int')

    # Map objects from matrix
    data_map = np.zeros(map_shape)

    temp = data_matrix.reshape(image_shape, image_shape, data_matrix.shape[1])

    for i in range(data_matrix.shape[1]):
        lower = (image_shape * (i // layout[1]),
                 image_shape * (i % layout[1]))
        upper = (image_shape * (i // layout[1] + 1),
                 image_shape * (i % layout[1] + 1))
        data_map[lower[0]:upper[0], lower[1]:upper[1]] = temp[:, :, i]

    return data_map.astype(int)