docs: def init_key_jar(public_path='', private_path='', key_defs='', owner='',
                   read_only=True):
      """
      A number of cases here:
  
      1. A private path is given
  
         a. The file exists and a JWKS is found there.
            From that JWKS a KeyJar instance is built.
         b.
            If the private path file doesn't exit the key definitions are
            used to build a KeyJar instance. A JWKS with the private keys are
            written to the file named in private_path.
  
         If a public path is also provided a JWKS with public keys are written
         to that file.
  
      2. A public path is given but no private path.
  
         a. If the public path file exists then the JWKS in that file is used to
            construct a KeyJar.
         b. If no such file exists then a KeyJar will be built
            based on the key_defs specification and a JWKS with the public keys
            will be written to the public path file.
  
      3. If neither a public path nor a private path is given then a KeyJar is
         built based on the key_defs specification and no JWKS will be written
         to file.
  
      In all cases a KeyJar instance is returned
  
      The keys stored in the KeyJar will be stored under the '' identifier.
  
      :param public_path: A file path to a file that contains a JWKS with public
          keys
      :param private_path: A file path to a file that contains a JWKS with
          private keys.
      :param key_defs: A definition of what keys should be created if they are
          not already available
      :param owner: The owner of the keys
      :param read_only: This function should not attempt to write anything
          to a file system.
      :return: An instantiated :py:class;`oidcmsg.key_jar.KeyJar` instance
      """
  
      if private_path:
          if os.path.isfile(private_path):
              _jwks = open(private_path, 'r').read()
              _kj = KeyJar()
              _kj.import_jwks(json.loads(_jwks), owner)
              if key_defs:
                  _kb = _kj.issuer_keys[owner][0]
                  _diff = key_diff(_kb, key_defs)
                  if _diff:
                      if read_only:
                          logger.error('Not allowed to write to disc!')
                      else:
                          update_key_bundle(_kb, _diff)
                          _kj.issuer_keys[owner] = [_kb]
                          jwks = _kj.export_jwks(private=True, issuer=owner)
                          fp = open(private_path, 'w')
                          fp.write(json.dumps(jwks))
                          fp.close()
          else:
              _kj = build_keyjar(key_defs, owner=owner)
              if not read_only:
                  jwks = _kj.export_jwks(private=True, issuer=owner)
                  head, tail = os.path.split(private_path)
                  if head and not os.path.isdir(head):
                      os.makedirs(head)
                  fp = open(private_path, 'w')
                  fp.write(json.dumps(jwks))
                  fp.close()
  
          if public_path and not read_only:
              jwks = _kj.export_jwks(issuer=owner)  # public part
              head, tail = os.path.split(public_path)
              if head and not os.path.isdir(head):
                  os.makedirs(head)
              fp = open(public_path, 'w')
              fp.write(json.dumps(jwks))
              fp.close()
      elif public_path:
          if os.path.isfile(public_path):
              _jwks = open(public_path, 'r').read()
              _kj = KeyJar()
              _kj.import_jwks(json.loads(_jwks), owner)
              if key_defs:
                  _kb = _kj.issuer_keys[owner][0]
                  _diff = key_diff(_kb, key_defs)
                  if _diff:
                      if read_only:
                          logger.error('Not allowed to write to disc!')
                      else:
                          update_key_bundle(_kb, _diff)
                          _kj.issuer_keys[owner] = [_kb]
                          jwks = _kj.export_jwks(issuer=owner)
                          fp = open(private_path, 'w')
                          fp.write(json.dumps(jwks))
                          fp.close()
          else:
              _kj = build_keyjar(key_defs, owner=owner)
              if not read_only:
                  _jwks = _kj.export_jwks(issuer=owner)
                  head, tail = os.path.split(public_path)
                  if head and not os.path.isdir(head):
                      os.makedirs(head)
                  fp = open(public_path, 'w')
                  fp.write(json.dumps(_jwks))
                  fp.close()
      else:
          _kj = build_keyjar(key_defs, owner=owner)
  
      return _kj