File includes:

```none
Honda
color white
trim black
Chevy
color blue
trim chrome
Hyundai
color red
trim black

```

Let's say I have hypothetical data from above. I'm trying to create a loop so that when Hyundai is found I get color red. The problem I'm having is when Hyundai is found the loop starts again from the beginning and I get white.

```
for line in data:
    if Hyundai in line:
       for line in data:
           if 'color' in line:
               color = get_color(line)
               print (color)

```

Hope this makes sense.