<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def merge_lists(dest, source, extend_lists=False):
 """Recursively merge two lists. :keyword extend_lists: if true, just extends lists instead of merging them. This applies merge_dictionary if any of the entries are dicts. Note: This updates dest and returns it. """

    if not source:
        return
    if not extend_lists:
        # Make them the same size
        left = dest
        right = source[:]
        if len(dest) > len(source):
            right.extend([None] * (len(dest) - len(source)))
        elif len(dest) < len(source):
            left.extend([None] * (len(source) - len(dest)))
        # Merge lists
        for index, value in enumerate(left):
            if value is None and right[index] is not None:
                dest[index] = right[index]
            elif isinstance(value, dict) and isinstance(right[index], dict):
                merge_dictionary(dest[index], source[index],
                                 extend_lists=extend_lists)
            elif isinstance(value, list):
                merge_lists(value, right[index])
            elif right[index] is not None:
                dest[index] = right[index]
    else:
        dest.extend([src for src in source if src not in dest])
    return dest