def genererate_principal(primary: str, instance: str, realm: str) -> str:
    """
    Generate a Kerberos principal from the three different components.
    """
    if instance:
        principal = "{}/{}".format(primary, instance)
    else:
        principal = primary

    return "{}@{}".format(principal, realm.upper())