def find_qpi_by_identifier(qps, identifier):
    """Find the QPImage that has the same initial parts as identifier

    Parameters
    ----------
    qps: qpimage.QPSereis
        Series data
    identifier: str
        A string "hash:number" that identifies a QPImage

    Returns
    -------
    qpi: qpimage.QPImage or None
        The `QPImage` in ``qps`` whose first two identifier parts match
        ``identifier`` or `None`, if no matching `QPImage` is found.
    """
    numid = identifier.count(":") + 1
    for qpi in qps:
        parts = qpi["identifier"].split(":")
        if ":".join(parts[:numid]) == identifier:
            break
    else:
        qpi = None
    return qpi