def hack_ncbi_fasta_name(pipe_name):
    """Turn 'gi|445210138|gb|CP003959.1|' into 'CP003959.1' etc.

    For use with NCBI provided FASTA and GenBank files to ensure
    contig names match up.

    Or Prokka's *.fna and *.gbk files, turning 'gnl|Prokka|contig000001'
    into 'contig000001'
    """
    if pipe_name.startswith("gi|") and pipe_name.endswith("|"):
        return pipe_name.split("|")[3]
    elif pipe_name.startswith("gnl|") and pipe_name.count("|")==2:
        return pipe_name.split("|")[2]
    else:
        return pipe_name