<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sort(ctx):
 """Sort the variants of a vcf file"""

    head = ctx.parent.head
    vcf_handle = ctx.parent.handle
    outfile = ctx.parent.outfile
    silent = ctx.parent.silent

    print_headers(head, outfile=outfile, silent=silent)

    for line in sort_variants(vcf_handle):
        print_variant(variant_line=line, outfile=outfile, silent=silent)