def encode_transition(transition):
    """
    Generate a key string from a transition.

    Both integer and string transition descriptions are handled.
    """
    upper, lower = transition
    upper = str(upper).lower()
    lower = str(lower).lower()
    return '{} -> {}'.format(upper, lower)
