def get_first_key(obj, key):
    """Return the value of the first key matching the given key.
    Recursively searches the obj.
    obj should contain at least one dict. Can be a nested dict or list of dicts
    or whatever.
    
    Returns None if not found
    """

    if type(obj) is dict and key in obj:
        return obj[key]
    elif type(obj) is dict:
        for k,v in obj.items():
            gfk = get_first_key(v, key)
            if gfk is not None:
                return gfk
    elif type(obj) is list:
        for item in obj:
            gfk = get_first_key(item, key)
            if gfk is not None:
                return gfk
    return None