docs: def output_filename(output_dir, key_handle, public_id):
      """
      Return an output filename for a generated AEAD. Creates a hashed directory structure
      using the last three bytes of the public id to get equal usage.
      """
      parts = [output_dir, key_handle] + pyhsm.util.group(public_id, 2)
      path = os.path.join(*parts)
  
      if not os.path.isdir(path):
          os.makedirs(path)
  
      return os.path.join(path, public_id)