def dump_jwks(kbl, target):
    """
    Write a JWK to a file

    :param kbl: List of KeyBundles
    :param target: Name of the file to which everything should be written
    """
    res = {"keys": []}
    for kb in kbl:
        # ignore simple keys
        res["keys"].extend([k.to_dict() for k in kb.keys() if
                            k.kty != 'oct' and not k.inactive_since])

    try:
        f = open(target, 'w')
    except __HOLE__:
        (head, tail) = os.path.split(target)
        os.makedirs(head)
        f = open(target, 'w')

    _txt = json.dumps(res)
    f.write(_txt)
    f.close()
dataset/ETHPy150Open rohe/pyoidc/src/oic/utils/keyio.py/dump_jwks