<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _check_shape(shape):
 """Verify that a shape has the right format."""

    if isinstance(shape, tuple):
        for dim in shape:
            if (isinstance(dim, tuple) and len(dim) == 2 and
                    isinstance(dim[0], int) and isinstance(dim[1], int)):
                if dim[0] < 0:
                    raise ValueError("expected low dimension to be >= 0")
                if dim[1] < 0:
                    raise ValueError("expected high dimension to be >= 0")
                if dim[0] > dim[1]:
                    raise ValueError("expected low <= high dimensions")
            else:
                raise TypeError("expected shape dimension to be (int, int)")
    else:
        raise TypeError("expected shape to be tuple of (int, int)")