A function for validating an individual token.

def verify_token(token, public_key_or_address, signing_algorithm="ES256K"):
    """ A function for validating an individual token.
    """
    decoded_token = decode_token(token)
    decoded_token_payload = decoded_token["payload"]

    if "subject" not in decoded_token_payload:
        raise ValueError("Token doesn't have a subject")
    if "publicKey" not in decoded_token_payload["subject"]:
        raise ValueError("Token doesn't have a subject public key")
    if "issuer" not in decoded_token_payload:
        raise ValueError("Token doesn't have an issuer")
    if "publicKey" not in decoded_token_payload["issuer"]:
        raise ValueError("Token doesn't have an issuer public key")
    if "claim" not in decoded_token_payload:
        raise ValueError("Token doesn't have a claim")

    issuer_public_key = str(decoded_token_payload["issuer"]["publicKey"])
    public_key_object = ECPublicKey(issuer_public_key)

    compressed_public_key = compress(issuer_public_key)
    decompressed_public_key = decompress(issuer_public_key)

    if public_key_object._type == PubkeyType.compressed:
        compressed_address = public_key_object.address()
        uncompressed_address = bin_hash160_to_address(
            bin_hash160(
                decompress(public_key_object.to_bin())
            )
        )
    elif public_key_object._type == PubkeyType.uncompressed:
        compressed_address = bin_hash160_to_address(
            bin_hash160(
                compress(public_key_object.to_bin())
            )
        )
        uncompressed_address = public_key_object.address()
    else:
        raise ValueError("Invalid issuer public key format")
   
    if public_key_or_address == compressed_public_key:
        pass
    elif public_key_or_address == decompressed_public_key:
        pass
    elif public_key_or_address == compressed_address:
        pass
    elif public_key_or_address == uncompressed_address:
        pass
    else:
        raise ValueError("Token public key doesn't match the verifying value")

    token_verifier = TokenVerifier()

    if not token_verifier.verify(token, public_key_object.to_pem()):
        raise ValueError("Token was not signed by the issuer public key")

    return decoded_token