code: def manhattan_distances(
      X, Y=None, sum_over_features=True, size_threshold=5e8
  ):
      """ Compute the L1 distances between the vectors in X and Y.
  
      With sum_over_features equal to False it returns the componentwise
      distances.
  
      Read more in the :ref:`User Guide <metrics>`.
  
      Parameters
      ----------
      X : array_like
          An array with shape (n_samples_X, n_features).
  
      Y : array_like, optional
          An array with shape (n_samples_Y, n_features).
  
      sum_over_features : bool, default=True
          If True the function returns the pairwise distance matrix
          else it returns the componentwise L1 pairwise-distances.
          Not supported for sparse matrix inputs.
  
      size_threshold : int, default=5e8
          Unused parameter.
  
      Returns
      -------
      D : array
          If sum_over_features is False shape is
          (n_samples_X * n_samples_Y, n_features) and D contains the
          componentwise L1 pairwise-distances (ie. absolute difference),
          else shape is (n_samples_X, n_samples_Y) and D contains
          the pairwise L1 distances.
  
      Examples
      --------
      >>> from sklearn.metrics.pairwise import manhattan_distances
      >>> manhattan_distances([[3]], [[3]])#doctest:+ELLIPSIS
      array([[ 0.]])
      >>> manhattan_distances([[3]], [[2]])#doctest:+ELLIPSIS
      array([[ 1.]])
      >>> manhattan_distances([[2]], [[3]])#doctest:+ELLIPSIS
      array([[ 1.]])
      >>> manhattan_distances([[1, 2], [3, 4]],\
           [[1, 2], [0, 3]])#doctest:+ELLIPSIS
      array([[ 0.,  2.],
             [ 4.,  4.]])
      >>> import numpy as np
      >>> X = np.ones((1, 2))
      >>> y = 2 * np.ones((2, 2))
      >>> manhattan_distances(X, y, sum_over_features=False)#doctest:+ELLIPSIS
      array([[ 1.,  1.],
             [ 1.,  1.]]...)
      """
      X, Y = check_pairwise_arrays(X, Y)
  
      if issparse(X) or issparse(Y):
          if not sum_over_features:
              raise TypeError(
                  "sum_over_features=%r not supported"
                  " for sparse matrices" % sum_over_features
              )
  
          X = csr_matrix(X, copy=False)
          Y = csr_matrix(Y, copy=False)
          D = np.zeros((X.shape[0], Y.shape[0]))
          _sparse_manhattan(
              X.data,
              X.indices,
              X.indptr,
              Y.data,
              Y.indices,
              Y.indptr,
              X.shape[1],
              D,
          )
          return D
  
      if sum_over_features:
          return distance.cdist(X, Y, "cityblock")
  
      D = X[:, np.newaxis, :] - Y[np.newaxis, :, :]
      D = np.abs(D, D)
      return D.reshape((-1, X.shape[1]))
  
imports: import itertools
  import numpy
  from scipy.spatial import distance
  from scipy.sparse import csr_matrix
  from scipy.sparse import issparse
  from ..utils import check_array
  from ..utils import gen_even_slices
  from ..utils import gen_batches
  from ..utils.fixes import partial
  from ..utils.extmath import row_norms, safe_sparse_dot
  from ..preprocessing import normalize
  from ..externals.joblib import Parallel
  from ..externals.joblib import delayed
  from ..externals.joblib import cpu_count
  from .pairwise_fast import _chi2_kernel_fast, _sparse_manhattan
label_desc: Use image node_id 7 for calling a global function with example usage: manhattan_distances(X, Y, sum_over_features, size_threshold) and returns: D, D, distance