'Get puppet or player.
Returns:
controller (Object or Player): The puppet if one exists,
otherwise return the player.'

def get_puppet_or_player(self):

    if self.logged_in:
        return (self.puppet if self.puppet else self.player)
    return None
