Question: This is homework, so I don't expect the answer, just a point in the right direction.

In python I have a dictionary that is like so:

```
{'bike101': ('Road Bike',
             [('WH139', 2),
              ('TR102', 2),
              ('TU177', 2),
              ('FR101', 1),
              ('FB101', 1),
              ('BB101', 1),
              ('GS101', 1)]),
 'bike201': ('Mountain Bike',
             [('WH239', 2),
              ('TR202', 2),
              ('TU277', 2),
              ('FR201', 1),
              ('FB201', 1),
              ('BB201', 1),
              ('GS201', 1)]),
 'bike301': ('Racing Bike',
             [('WH339', 2),
              ('TR302', 2),
              ('TU377', 2),
              ('FR301', 1),
              ('FB301', 1),
              ('BB301', 1),
              ('GS301', 1)])}

```

For example 'Racing Bike' is the product name and the list of pairs is (part, amount required), respectively.

I have to write a function that, given the above dictionary and the product name as an argument will then return the key for it and return 'None' if the product name does not exist.

I used:

```
    return [key for key, value in product_dict.iteritems() if list(value)[0] == string]

```

And this returned the correct key when tested but I don't know how to make it return 'none' if the product name doesn't exist and I am not sure if this is the best way to do this.'

I can only use the builtin functions in python, any help is greatly appreciated!

Answer: 
Since you're asking for hints, I won't post working code.

Your code is a list comprehension, so it outputs a list. If there is no result, the list will be empty. You can bind the list to a variable, use `len()` to check its length and return `None` if it is 0.
Using a list comprehension is perhaps not the most obvious way here since you're not building a list but searching for a single item. Your code is not returning the key but a list of size 1 if the key is found or a list of size 0 if it doesn't exist.

One way to use this to your advantage is to access the first element (`[0]`) of your list comprehension. Then you'll get an `IndexError` if the list is empty. Surround the list comprehension with a `try/except` and return `None` if `IndexError` is raised.