def modulo_counter(start=0., modulo=256., step=1.):
  """
  Creates a lazy endless counter stream with the given modulo, i.e., its
  values ranges from 0. to the given "modulo", somewhat equivalent to:\n
    Stream(itertools.count(start, step)) % modulo\n
  Yet the given step can be an iterable, and doen't create unneeded big
  ints. All inputs can be float. Input order remembers slice/range inputs.
  All inputs can also be iterables. If any of them is an iterable, the end
  of this counter happen when there's no more data in one of those inputs.
  to continue iteration.
  """
  if isinstance(start, collections.Iterable):
    lastp = 0.
    c = 0.
    if isinstance(step, collections.Iterable):
      if isinstance(modulo, collections.Iterable):
        for p, m, s in xzip(start, modulo, step):
          c += p - lastp
          c = c % m % m
          yield c
          c += s
          lastp = p
      else:
        for p, s in xzip(start, step):
          c += p - lastp
          c = c % modulo % modulo
          yield c
          c += s
          lastp = p
    else:
      if isinstance(modulo, collections.Iterable):
        for p, m in xzip(start, modulo):
          c += p - lastp
          c = c % m % m
          yield c
          c += step
          lastp = p
      else: # Only start is iterable. This should be optimized!
        if step == 0:
          for p in start:
            yield p % modulo % modulo
        else:
          steps = int(modulo / step)
          if steps > 1:
            n = 0
            for p in start:
              c += p - lastp
              yield (c + n * step) % modulo % modulo
              lastp = p
              n += 1
              if n == steps:
                n = 0
                c = (c + steps * step) % modulo % modulo
          else:
            for p in start:
              c += p - lastp
              c = c % modulo % modulo
              yield c
              c += step
              lastp = p
  else:
    c = start
    if isinstance(step, collections.Iterable):
      if isinstance(modulo, collections.Iterable):
        for m, s in xzip(modulo, step):
          c = c % m % m
          yield c
          c += s
      else: # Only step is iterable. This should be optimized!
        for s in step:
          c = c % modulo % modulo
          yield c
          c += s
    else:
      if isinstance(modulo, collections.Iterable):
        for m in modulo:
          c = c % m % m
          yield c
          c += step
      else: # None is iterable
        if step == 0:
          c = start % modulo % modulo
          while True:
            yield c
        else:
          steps = int(modulo / step)
          if steps > 1:
            n = 0
            while True:
              yield (c + n * step) % modulo % modulo
              n += 1
              if n == steps:
                n = 0
                c = (c + steps * step) % modulo % modulo
          else:
            while True:
              c = c % modulo % modulo
              yield c
              c += step