def setup_output_vcf(outname, t_vcf):
    """
    Create an output vcf.Writer given the input vcf file as a templte
    writes the full header and
    Adds info fields:
        sizeCat
        MEF
    Returns a file handler and a dict with {individual_id: column in vcf}
    """
    out = open(outname, 'w')
    line = t_vcf.readline()
    samp_columns = {}
    while not line.startswith("#CHROM"):
        out.write(line)
        line = t_vcf.readline()

    # edit the header
    out.write('##INFO=<ID=sizeCat,Number=A,Type=String,Description="Size category of variant">\n')
    out.write('##INFO=<ID=MEF,Number=.,Type=String,Description="Names of families that contain mendelian error">\n')
    out.write(line)
    for pos, iid in enumerate(line.strip().split('\t')[9:]):
        samp_columns[iid] = pos + 9
    return out, samp_columns