async def METHOD_NAME(msg: SignIdentity) -> SignedIdentity:
    from trezor.messages import SignedIdentity
    from trezor.ui.layouts import confirm_sign_identity
    from apps.common.keychain import get_keychain
    from apps.common.paths import AlwaysMatchingSchema
    msg_identity = msg.identity  # local_cache_attribute
    msg_identity_proto = msg_identity.proto  # local_cache_attribute
    challenge_visual = msg.challenge_visual  # local_cache_attribute
    challenge_hidden = msg.challenge_hidden  # local_cache_attribute
    curve_name = msg.ecdsa_curve_name or "secp256k1"
    keychain = await get_keychain(curve_name, [AlwaysMatchingSchema])
    identity = serialize_identity(msg_identity)
    # require_confirm_sign_identity
    proto = msg_identity_proto.upper() if msg_identity_proto else "identity"
    await confirm_sign_identity(
        proto, serialize_identity_without_proto(msg_identity), challenge_visual
    )
    # END require_confirm_sign_identity
    address_n = get_identity_path(identity, msg_identity.index or 0, 13)
    node = keychain.derive(address_n)
    coin = coininfo.by_name("Bitcoin")
    if curve_name == "secp256k1":
        # hardcoded bitcoin address type
        address: str | None = node.address(coin.address_type)
    else:
        address = None
    pubkey = node.public_key()
    if pubkey[0] == 0x01:
        pubkey = b"\x00" + pubkey[1:]
    seckey = node.private_key()
    if msg_identity_proto in ("gpg", "signify", "ssh"):
        sigtype = msg_identity_proto
    else:
        sigtype = coin
    signature = sign_challenge(
        seckey,
        challenge_hidden,
        challenge_visual,
        sigtype,
        curve_name,
    )
    return SignedIdentity(address=address, public_key=pubkey, signature=signature)