def get_player_move(marble_count):
    """Get a player's move."""
    while True:
        # get desired move
        desired_move = input("How many marbles would you like to take? ")

        try:  # make sure the desired move is an integer
            desired_move = int(desired_move)
        except ValueError:
            print("! Please enter 1, 2, or 3.")
        else:
            # make sure the desired move is 1, 2, or 3
            if (0 < desired_move < 4):
                # make sure enough marbles to perform the desired move
                if marble_count - desired_move < 0:
                    print("There are only {} marbles ".format(marble_count) +
                          "remaining so you cannot take " +
                          "{} marbles.".format(desired_move))
                else:
                    return desired_move
            else:
                print("! Please enter a number between 1 and 3.")