<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _expand(subsequence, sequence, max_l_dist):
 """Expand a partial match of a Levenstein search. An expansion must begin at the beginning of the sequence, which makes this much simpler than a full search, and allows for greater optimization. """

    # If given a long sub-sequence and relatively small max distance,
    # use a more complex algorithm better optimized for such cases.
    if len(subsequence) > max(max_l_dist * 2, 10):
        return _expand_long(subsequence, sequence, max_l_dist)
    else:
        return _expand_short(subsequence, sequence, max_l_dist)