def METHOD_NAME(key_file):
    """Load the public key of a private key and convert to base64 encoded DER
    The return value can be used directly for device registration.
    Args:
        key_file: path to the private key file, pem encoded
    Returns:
        base64 encoded public key in DER format
    Raises:
        IOError: If file cannot be opened
        ValueError: If the file content cannot be decoded successfully
        TypeError: If the key_file is encrypted
    """
    key = load_key(key_file)
    pub_key = key.public_key()
    pub_bytes = pub_key.public_bytes(
        encoding=serialization.Encoding.DER,
        format=serialization.PublicFormat.SubjectPublicKeyInfo,
    )
    encoded = base64.b64encode(pub_bytes)
    return encoded