docs: def flatten(repertoire, big_endian=False):
      """Flatten a repertoire, removing empty dimensions.
  
      By default, the flattened repertoire is returned in little-endian order.
  
      Args:
          repertoire (np.ndarray or None): A repertoire.
  
      Keyword Args:
          big_endian (boolean): If ``True``, flatten the repertoire in big-endian
              order.
  
      Returns:
          np.ndarray: The flattened repertoire.
      """
      if repertoire is None:
          return None
  
      order = 'C' if big_endian else 'F'
      # For efficiency, use `ravel` (which returns a view of the array) instead
      # of `np.flatten` (which copies the whole array).
      return repertoire.squeeze().ravel(order=order)