def assert_sample_in_header(vcf_object, sample, can_fail=False):
    """
    Asserts that a given sample is in the VCF header and returns the index.

    :param vcf_object: ``~pysam.VariantFile`` instance
    :param sample: the sample's name
    :return: sample column index
    """
    idx = None
    if not can_fail:
        assert (
            sample in vcf_object.header.samples
        ), "Unable to find sample {0} in VCF header!".format(sample)

    # Get the index of the samples
    try:
        slist = list(vcf_object.header.samples)
        idx = slist.index(sample) + 9
    except ValueError:
        pass
    return idx