def buy_book(bookID, shippingAddress, paymentMethod):
    """Purchase a book with given ID and ship it to the address provided"""
    # TODO: Reject payment if the payment method is "cash"
    # TODO: Calculate shipping cost using the shipping address
    print("Book purchased")
Apply the changes requested in the comment for the following piece of code.
Here is one way to apply the requested changes:

```python
def buy_book(bookID, shippingAddress, paymentMethod):
    """Purchase a book with given ID and ship it to the address provided"""
    
    # Reject payment if the payment method is "cash"
    if paymentMethod == "cash":
        print("Sorry, cash payments are not accepted.")
        return

    # Calculate shipping cost using the shipping address
    shippingCost = calculate_shipping_cost(shippingAddress)
    
    print(f"Book purchased. Total cost including shipping: {shippingCost}")

def calculate_shipping_cost(shippingAddress):
    # some code to calculate the cost of shipping
    pass
```