def METHOD_NAME(
    filename: Union[str, os.PathLike]
) -> Tuple[bytes, Optional[bytes]]:
    """Load public and secret key from a zmq certificate.
    Returns (public_key, secret_key)
    If the certificate file only contains the public key,
    secret_key will be None.
    If there is no public key found in the file, ValueError will be raised.
    """
    public_key = None
    secret_key = None
    if not os.path.exists(filename):
        raise OSError(f"Invalid certificate file: {filename}")
    with open(filename, 'rb') as f:
        for line in f:
            line = line.strip()
            if line.startswith(b'#'):
                continue
            if line.startswith(b'public-key'):
                public_key = line.split(b"=", 1)[1].strip(b' \t\'"')
            if line.startswith(b'secret-key'):
                secret_key = line.split(b"=", 1)[1].strip(b' \t\'"')
            if public_key and secret_key:
                break
    if public_key is None:
        raise ValueError("No public key found in %s" % filename)
    return public_key, secret_key