def validate_inputs(*arrays, **kwargs):
    arrays = np.broadcast_arrays(*arrays)
    sort_by = kwargs.pop('sort_by', None)
    if kwargs:
        raise ValueError("unrecognized arguments: {0}".format(kwargs.keys()))
    if arrays[0].ndim != 1:
        raise ValueError("Input arrays should be one-dimensional.")
    if sort_by is not None:
        isort = np.argsort(sort_by)
        if isort.shape != arrays[0].shape:
            raise ValueError("sort shape must equal array shape.")
        arrays = tuple([a[isort] for a in arrays])
    return arrays