def check_mesh(dim, x, y, z, mesh_type):
    """Do a basic check of the shapes of the input arrays."""
    if dim >= 2:
        if y is None:
            raise ValueError('The y-component is missing for {0} dimensions'
                .format(dim))
    if dim == 3:
        if z is None:
            raise ValueError('The z-component is missing for {0} dimensions'
                .format(dim))
    if mesh_type == 'unstructured':
        if dim >= 2:
            try:
                if len(x) != len(y):
                    raise ValueError(
                        'len(x) = {0} != len(y) = {1} for unstructured grids'
                        .format(len(x), len(y)))
            except TypeError:
                pass
            if dim == 3:
                try:
                    if len(x) != len(z):
                        raise ValueError(
                            'len(x) = {0} != len(z) = {1} for unstructured grids'
                            .format(len(x), len(z)))
                except TypeError:
                    pass
    elif mesh_type == 'structured':
        pass
    else:
        raise ValueError('Unknown mesh type {0}'.format(mesh_type))
