Get a player attribute that depends on which side the player is on.
    A creep kill for a radiant hero is a badguy_kill, while a creep kill
    for a dire hero is a goodguy_kill.

def get_side_attr(attr, invert, player):
    """
    Get a player attribute that depends on which side the player is on.
    A creep kill for a radiant hero is a badguy_kill, while a creep kill
    for a dire hero is a goodguy_kill.
    """
    t = player.team
    if invert:
        t = not player.team

    return getattr(player, "%s_%s" % ("goodguy" if t else "badguy", attr))