def get_info_dictionary(rec, info_fields):
    """Parses info into a dictionary with info fields as the keys

    Parameters
    ----------
    rec : pysam.libcbcf.VariantRecord
        Obatined from iterating over pysam.VariantFile.fetch()
    info_fields : list
        List of info fields in the vcf

    Returns
    -------
    dict
        Info field parsed into a dictionary
    """

    info_data = rec.info["CSQ"]
    info_dict = [
        dict(zip(info_fields, x.split("|")))
        for x in info_data
        if len(x.split("|")) == len(info_fields)
    ]

    return info_dict