code: def _ravel_and_check_weights(a, weights):
      """Check a and weights have matching shapes, and ravel both"""
      a = np.asarray(a)
  
      # Ensure that the array is a "subtractable" dtype
      if a.dtype == np.bool_:
          warnings.warn(
              "Converting input from {} to {} for compatibility.".format(
                  a.dtype, np.uint8
              ),
              RuntimeWarning,
              stacklevel=3,
          )
          a = a.astype(np.uint8)
  
      if weights is not None:
          weights = np.asarray(weights)
          if weights.shape != a.shape:
              raise ValueError(
                  "weights should have the same shape as a."
              )
          weights = weights.ravel()
      a = a.ravel()
      return a, weights
  
imports: import contextlib
  import functools
  import operator
  import warnings
  import numpy
  from numpy.core import overrides
label_desc: Use image node_id 10 for calling a global function with example usage: _ravel_and_check_weights(a, weights) and returns: a,  weights