def buy(self, player, cost):
if cost > self.max_bid():<EOL><INDENT>raise InsufficientFundsError()<EOL><DEDENT>elif not any(roster_slot.accepts(player) and roster_slot.occupant is None for roster_slot in self.roster):<EOL><INDENT>raise NoValidRosterSlotError()<EOL><DEDENT>elif self.owns(player):<EOL><INDENT>raise AlreadyPurchasedError()<EOL><DEDENT>self.money -= cost<EOL>self._remaining_picks -= <NUM_LIT:1><EOL>self._owned_player_ids.add(player.player_id)<EOL>self._slot_in(player, cost)<EOL>
indicate that the player was bought at the specified cost

:param Player player: player to buy
:param int cost: cost to pay

:raises InsufficientFundsError: if owner doesn't have the money
:raises NoValidRosterSlotError: if owner doesn't have a slot this player could fill
:raises AlreadyPurchasedError: if owner already bought this player