<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run(samples, run_parallel, stage):
 """Run structural variation detection. The stage indicates which level of structural variant calling to run. - initial, callers that can be used in subsequent structural variation steps (cnvkit -> lumpy) - standard, regular batch calling - ensemble, post-calling, combine other callers or prioritize results """

    to_process, extras, background = _batch_split_by_sv(samples, stage)
    processed = run_parallel("detect_sv", ([xs, background, stage]
                                           for xs in to_process.values()))
    finalized = (run_parallel("finalize_sv", [([xs[0] for xs in processed], processed[0][0]["config"])])
                 if len(processed) > 0 else [])
    return extras + finalized