def slicebyn(obj, n, end=None):
    """
    Iterator over n-length slices of obj from the range 0 to end.
    end defaults to len(obj).
    """
    if end is None:
        end = len(obj)
    return (obj[i:i+n] for i in range(0, end, n))