code: def partition(n, p):
      """Get partition sizes for a given number of samples and partitions.
  
      This method will give an array containing the sizes of ``p`` partitions
      given a total sample size of ``n``. If there is a remainder from the
      split, the r first folds will be incremented by 1.
  
      Parameters
      ----------
      n : int
          number of samples.
  
      p : int
          number of partitions.
  
      Examples
      --------
  
      Return sample sizes of 2 partitions given a total of 4 samples
  
      >>> from mlens.index.base import partition
      >>> _partition(4, 2)
      array([2, 2])
  
      Return sample sizes of 3 partitions given a total of 8 samples
  
      >>> from mlens.index.base import partition
      >>> _partition(8, 3)
      array([3, 3, 2])
      """
      sizes = (n // p) * np.ones(p, dtype=np.int)
      sizes[: n % p] += 1
      return sizes
  
imports: from __future__ import division
  from abc import abstractmethod
  import numpy
  from ..externals.sklearn.base import BaseEstimator
label_desc: Use image node_id 2 for calling a global function with example usage: partition(n, p) and returns: sizes