def get_identified_transient_identity_and_traits(
    environment: Environment,
    identifier: str,
    sdk_trait_data: list[SDKTraitData],
) -> IdentityAndTraits:
    """
    Get a transient `Identity` instance.
    If present in storage, it's a previously persisted identity with its traits,
    combined with incoming traits provided to `sdk_trait_data` argument.
    All traits constructed from `sdk_trait_data` are marked as transient.
    """
    sdk_trait_data = _ensure_transient(sdk_trait_data)
    if identity := Identity.objects.filter(
        environment=environment,
        identifier=identifier,
    ).first():
        return identity, identity.update_traits(sdk_trait_data)
    return (
        identity := _get_transient_identity(
            environment=environment,
            identifier=identifier,
        )
    ), identity.generate_traits(sdk_trait_data, persist=False)

    Get a transient `Identity` instance.
    If present in storage, it's a previously persisted identity with its traits,
    combined with incoming traits provided to `sdk_trait_data` argument.
    All traits constructed from `sdk_trait_data` are marked as transient.
    
api/environments/sdk/services.py