docs: def balanced_repartition(data, partitions):
      """ balanced_repartition(data, partitions)
      Reparations an RDD making sure data is evenly distributed across partitions
      for Spark version < 2.1 (see: https://issues.apache.org/jira/browse/SPARK-17817)
      or < 2.3 when #partitions is power of 2 (see: https://issues.apache.org/jira/browse/SPARK-21782)
  
      :param data: RDD
      :param partitions: number of partition to use
      :return: repartitioned data
      """
  
      def repartition(data_inner, partitions_inner):
          # repartition by zipping an index to the data, repartition by % on it and removing it
          data_inner = data_inner.zipWithIndex().map(lambda x: (x[1], x[0]))
          data_inner = data_inner.partitionBy(partitions_inner, lambda x: x % partitions_inner)
          return data_inner.map(lambda x: x[1])
  
      if isinstance(data, RDD):
          return repartition(data, partitions)
      else:
          raise ValueError('Wrong data type, expected [RDD, Images, Series] got: %s' % type(data))