def split_pem(pem_bytes: bytes):
    """
    Split a give PEM file with multiple certificates.

    :param pem_bytes: The pem data in bytes with multiple certs
    :return: yields a list of certificates contained in the pem file
    """
    started, pem_data = False, b''
    for line in pem_bytes.splitlines(False):
        if line == b'' and not started:
            continue
        if line[0:5] in (b'-----', b'---- '):
            if not started:
                started = True
            else:
                pem_data = pem_data + line + b'\r\n'
                yield pem_data
                started = False
                pem_data = b''
        if started:
            pem_data = pem_data + line + b'\r\n'
