def slice_by_value(sequence, start=None, end=None, step=1):
    """Returns the earliest slice of the sequence bounded by the
    start and end values. Omitted optional parameters work as expected
    for slicing.

    slice_by_value('hello there world', 'o', 'w', 2) -> 'otee'
    """
    i_start = i_end = None
    if start is not None:
        i_start = sequence.index(start)
    if end is not None:
        i_end = sequence.index(end)
    return sequence[i_start:i_end:step]