import re


def seqid2accver(seqid):
    """Convert NCBI-style sequence Id to accession.version.

    Parameters
    ----------
    seqid : str
        original sequence Id (may be seqid or accver)

    Returns
    -------
    str
        sequence Id in accver format

    Notes
    -----
    Newer NCBI BLAST programs use accver instead of seqid in the standard
    tabular format, producing the desired sequence Id like "NP_123456.1".
    However older programs may produce "ref|NP_123456.1|", which needs to
    be converted to the actual sequence Id.
    """
    m = re.match(r'^[^|]+\|([^|]+)\|$', seqid)
    return m.group(1) if m else seqid