def get_key(data, search_key):
    """Goes through a template looking for a key.

    :param data: The template to traverse.
    :param search_key: The key to look for.
    :return The key value.
    """
    return_value = None
    found = False
    if isinstance(data, dict):
        bucket = []
        for key, value in data.iteritems():
            if key == search_key:
                return_value = value
                found = True
                break
            else:
                bucket.append(value)
        if bucket and not found:
            for element in bucket:
                if isinstance(element, list):
                    for element in element:
                        bucket.append(element)
                elif isinstance(element, dict):
                    for key, value in element.iteritems():
                        if key == search_key:
                            return_value = value
                            found = True
                            break
                        else:
                            bucket.append(value)
                if found:
                    break
    return return_value
