def public_key_to_address(public_key: Union[PublicKey, bytes]) -> ChecksumAddress:
    """ Converts a public key to an Ethereum address. """
    if isinstance(public_key, PublicKey):
        public_key = public_key.format(compressed=False)
    assert isinstance(public_key, bytes)
    return to_checksum_address(sha3(public_key[1:])[-20:])
Converts a public key to an Ethereum address.