docs: def data_chunk(data, chunk, with_overlap=False):
      """Get a data chunk."""
      assert isinstance(chunk, tuple)
      if len(chunk) == 2:
          i, j = chunk
      elif len(chunk) == 4:
          if with_overlap:
              i, j = chunk[:2]
          else:
              i, j = chunk[2:]
      else:
          raise ValueError("'chunk' should have 2 or 4 elements, "
                           "not {0:d}".format(len(chunk)))
      return data[i:j, ...]