docs: def sliceit(iterable, lower=0, upper=None):
      """Apply a slice on input iterable.
  
      :param iterable: object which provides the method __getitem__ or __iter__.
      :param int lower: lower bound from where start to get items.
      :param int upper: upper bound from where finish to get items.
      :return: sliced object of the same type of iterable if not dict, or specific
          object. otherwise, simple list of sliced items.
      :rtype: Iterable
      """
  
      if upper is None:
          upper = len(iterable)
  
      try:
          result = iterable[lower: upper]
  
      except TypeError:  # if iterable does not implement the slice method
          result = []
  
          if lower < 0:  # ensure lower is positive
              lower += len(iterable)
  
          if upper < 0:  # ensure upper is positive
              upper += len(iterable)
  
          if upper > lower:
              iterator = iter(iterable)
  
              for index in range(upper):
                  try:
                      value = next(iterator)
  
                  except StopIteration:
                      break
  
                  else:
                      if index >= lower:
                          result.append(value)
  
      iterablecls = iterable.__class__
      if not(isinstance(result, iterablecls) or issubclass(iterablecls, dict)):
          try:
              result = iterablecls(result)
  
          except TypeError:
              pass
  
      return result