user
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.

### Instruction:
Write a function to classify objects by their color.

### Input:
Objects: apple (red), banana (yellow), book (black)

### Response:
assistant
def classify_by_color(objects):
    classified = {'red': [], 'yellow': [], 'black': []}
    for object in objects:
        name, color = object.split(' (')
        color = color[:-1]  # remove trailing )
        classified[color].append(name)
    return classified