code: def write_object(ctx, pin, management_key, object_id, data):
      
  
      controller = ctx.obj['controller']
      _ensure_authenticated(ctx, controller, pin, management_key)
  
      def do_write_object(retry=True):
          try:
              controller.put_data(object_id, data.read())
          except APDUError as e:
              logger.debug('Failed writing object', exc_info=e)
              if e.sw == SW.INCORRECT_PARAMETERS:
                  ctx.fail('Something went wrong, is the object id valid?')
              raise
  
      do_write_object()
docs: Write an arbitrary PIV object.
  
      Write a PIV object by providing the object id.
      Yubico writable PIV objects are available in
      the range 5f0000 - 5fffff.
  
      \b
      OBJECT-ID       Id of PIV object in HEX.
      DATA            File containing the data to be written. Use '-' to use stdin.