def chromosome_converter(chrom, from_malariagen):
    """ Convert plasmodium chromosome names from standard (chr1, etc) to
    malariagen names (Pf3d7...) and vice versa.
    """
    standard_names = ["chr" + str(i) for i in range(1, 15)]
    standard_names.extend(["chrM", "chrP"])
    malariagen_names = ["Pf3D7_0" + str(i) + "_v3" for i in range(1, 10)]
    malariagen_names = malariagen_names + [
        "Pf3D7_" + str(i) + "_v3" for i in range(10, 15)]
    malariagen_names.extend(["Pf_M76611", "Pf3D7_API_v3"])
    if from_malariagen:
        return dict(zip(malariagen_names, standard_names))[chrom]
    else:
        return dict(zip(standard_names, malariagen_names))[chrom]