def _get_slice_len(slc, seq_length):
    """Given a python slice object and the length of the sequence, calculate the number of elements
     in the slice.

    Parameters
    ----------
    slc : py_slice
        The slice object
    seq_length : int
        The length of the object you are going to apply the slice on

    Returns
    -------
    ret : int
        Total number of elements in the slice
    """
    start, stop, step = slc.indices(seq_length)
    return max(0, (stop - start + (step - (1 if step > 0 else -1))) // step)
