def check_arrays(*arrays, **options):
sparse_format = options.pop('<STR_LIT>', None)<EOL>if sparse_format not in (None, '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>raise ValueError('<STR_LIT>' % sparse_format)<EOL><DEDENT>copy = options.pop('<STR_LIT>', False)<EOL>check_ccontiguous = options.pop('<STR_LIT>', False)<EOL>dtype = options.pop('<STR_LIT>', None)<EOL>warn_nans = options.pop('<STR_LIT>', False)<EOL>replace_nans = options.pop('<STR_LIT>', False)<EOL>allow_lists = options.pop('<STR_LIT>', False)<EOL>allow_nans = options.pop('<STR_LIT>', False)<EOL>allow_nd = options.pop('<STR_LIT>', False)<EOL>if options:<EOL><INDENT>raise TypeError("<STR_LIT>" % options.keys())<EOL><DEDENT>if len(arrays) == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>n_samples = num_samples(arrays[<NUM_LIT:0>])<EOL>checked_arrays = []<EOL>for array in arrays:<EOL><INDENT>array_orig = array<EOL>if array is None:<EOL><INDENT>checked_arrays.append(array)<EOL>continue<EOL><DEDENT>size = num_samples(array)<EOL>if size != n_samples:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>% (size, n_samples))<EOL><DEDENT>if not allow_lists or hasattr(array, "<STR_LIT>"):<EOL><INDENT>if sp.issparse(array):<EOL><INDENT>if sparse_format == '<STR_LIT>':<EOL><INDENT>array = array.tocsr()<EOL><DEDENT>elif sparse_format == '<STR_LIT>':<EOL><INDENT>array = array.tocsc()<EOL><DEDENT>elif sparse_format == '<STR_LIT>':<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if check_ccontiguous:<EOL><INDENT>array.data = np.ascontiguousarray(array.data, dtype=dtype)<EOL><DEDENT>elif hasattr(array, '<STR_LIT:data>'):<EOL><INDENT>array.data = np.asarray(array.data, dtype=dtype)<EOL><DEDENT>elif array.dtype != dtype:<EOL><INDENT>array = array.astype(dtype)<EOL><DEDENT>if not allow_nans:<EOL><INDENT>if hasattr(array, '<STR_LIT:data>'):<EOL><INDENT>_assert_all_finite(array.data)<EOL><DEDENT>else:<EOL><INDENT>_assert_all_finite(array.values())<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if check_ccontiguous:<EOL><INDENT>array = np.ascontiguousarray(array, dtype=dtype)<EOL><DEDENT>else:<EOL><INDENT>array = np.asarray(array, dtype=dtype)<EOL><DEDENT>if warn_nans:<EOL><INDENT>allow_nans = True<EOL>_warn_if_not_finite(array)<EOL><DEDENT>if replace_nans:<EOL><INDENT>array = np.nan_to_num(array)<EOL><DEDENT>if not allow_nans:<EOL><INDENT>_assert_all_finite(array)<EOL><DEDENT><DEDENT>if not allow_nd and array.ndim >= <NUM_LIT:3>:<EOL><INDENT>raise ValueError("<STR_LIT>" %<EOL>array.ndim)<EOL><DEDENT><DEDENT>if copy and array is array_orig:<EOL><INDENT>array = array.copy()<EOL><DEDENT>checked_arrays.append(array)<EOL><DEDENT>return checked_arrays<EOL>
Check that all arrays have consistent first dimensions.

    Checks whether all objects in arrays have the same shape or length.
    By default lists and tuples are converted to numpy arrays.

    It is possible to enforce certain properties, such as dtype, continguity
    and sparse matrix format (if a sparse matrix is passed).

    Converting lists to arrays can be disabled by setting ``allow_lists=True``.
    Lists can then contain arbitrary objects and are not checked for dtype,
    finiteness or anything else but length. Arrays are still checked
    and possibly converted.

    Parameters
    ----------
    *arrays : sequence of arrays or scipy.sparse matrices with same shape[0]
        Python lists or tuples occurring in arrays are converted to 1D numpy
        arrays, unless allow_lists is specified.
    sparse_format : 'csr', 'csc' or 'dense', None by default
        If not None, any scipy.sparse matrix is converted to
        Compressed Sparse Rows or Compressed Sparse Columns representations.
        If 'dense', an error is raised when a sparse array is
        passed.
    copy : boolean, False by default
        If copy is True, ensure that returned arrays are copies of the original
        (if not already converted to another format earlier in the process).
    check_ccontiguous : boolean, False by default
        Check that the arrays are C contiguous
    dtype : a numpy dtype instance, None by default
        Enforce a specific dtype.
    warn_nans : boolean, False by default
        Prints warning if nans in the arrays
        Disables allow_nans
    replace_nans : boolean, False by default
        Replace nans in the arrays with zeros
    allow_lists : bool
        Allow lists of arbitrary objects as input, just check their length.
        Disables
    allow_nans : boolean, False by default
        Allows nans in the arrays
    allow_nd : boolean, False by default
        Allows arrays of more than 2 dimensions.