def METHOD_NAME(key_file_name: str, key_contents: bytes) -> AddKeyResult:
    """
    Add a key file (for later use in EAP config) to the system.
    """
    keys_dir = CONFIG["wifi_keys_dir"]
    hasher = hashlib.sha256()
    hasher.update(key_contents)
    key_hash = hasher.hexdigest()
    if key_hash in os.listdir(keys_dir):
        files = os.listdir(os.path.join(keys_dir, key_hash))
        if files:
            return AddKeyResult(
                created=False, key=Key(directory=key_hash, file=files[0])
            )
        else:
            log.warning("Key directory with nothing in it: {}".format(key_hash))
            os.rmdir(os.path.join(keys_dir, key_hash))
    key_hash_path = os.path.join(keys_dir, key_hash)
    os.mkdir(key_hash_path)
    with open(os.path.join(key_hash_path, os.path.basename(key_file_name)), "wb") as f:
        f.write(key_contents)
    return AddKeyResult(created=True, key=Key(directory=key_hash, file=key_file_name))