def _slot_in(self, player, cost):
        """

        :param Player player: player to slot into the owner's current roster. Puts this
            player in the most specific slot that it can occupy, kicking out any lower-value players
            (and finding alternate slots for them) if the slot is occupied. If this player is lower valued than
            that of a player in an occupied slot, finds the next most specific slot and so on.

            This has the side effect of ensuring that the highest value players are on the start rather than the
            bench. It also seems to match how fantasy owners like to order their team.
        :param int cost: cost paid for this player

        """

        # find the most specific slot this player can fit into where they are the highest value.
        to_replace = player
        to_replace_cost = cost
        for roster_slot in self.roster:
            if roster_slot.accepts(to_replace):
                # check if the slot is already occupied
                if roster_slot.occupant is None:
                    # We're done. Just put the new person here.
                    roster_slot.occupant = to_replace
                    roster_slot.cost = to_replace_cost
                    break
                elif to_replace.value > roster_slot.occupant.value:
                    # the new player's value is higher than this slot's value, so
                    # put the new player here and kick out the old player, then keep looking
                    # for a new spot for the kicked-out player
                    replacee = roster_slot.occupant
                    replacee_cost = roster_slot.cost
                    roster_slot.occupant = to_replace
                    roster_slot.cost = to_replace_cost
                    to_replace = replacee
                    to_replace_cost = replacee_cost
def _slot_in ( self , player , cost ) : to_replace = player to_replace_cost = cost for roster_slot in self . roster : if roster_slot . accepts ( to_replace ) : if roster_slot . occupant is None : roster_slot . occupant = to_replace roster_slot . cost = to_replace_cost break elif to_replace . value > roster_slot . occupant . value : replacee = roster_slot . occupant replacee_cost = roster_slot . cost roster_slot . occupant = to_replace roster_slot . cost = to_replace_cost to_replace = replacee to_replace_cost = replacee_cost
:param Player player: player to slot into the owner's current roster. Puts this
            player in the most specific slot that it can occupy, kicking out any lower-value players
            (and finding alternate slots for them) if the slot is occupied. If this player is lower valued than
            that of a player in an occupied slot, finds the next most specific slot and so on.

            This has the side effect of ensuring that the highest value players are on the start rather than the
            bench. It also seems to match how fantasy owners like to order their team.
        :param int cost: cost paid for this player