code: def accumulate_impl(func, sequence):
      # pylint: disable=no-name-in-module
      
      if six.PY3:
          from itertools import accumulate
          return accumulate(sequence, func)
      else:
          return _accumulate(sequence, func)
docs: Implementation for accumulate
      :param sequence: sequence to accumulate
      :param func: accumulate function