docs: def _blob_end_handler_factory():
      """Generates the handler for the end of a blob value. This includes the base-64 data and the two closing braces."""
      def expand_res(res):
          if res is None:
              return 0, 0
          return res
  
      def action(c, ctx, prev, res, is_first):
          num_digits, num_pads = expand_res(res)
          if c in _BASE64_DIGITS:
              if prev == _CLOSE_BRACE or prev == _BASE64_PAD:
                  _illegal_character(c, ctx.set_ion_type(IonType.BLOB))
              num_digits += 1
          elif c == _BASE64_PAD:
              if prev == _CLOSE_BRACE:
                  _illegal_character(c, ctx.set_ion_type(IonType.BLOB))
              num_pads += 1
          else:
              _illegal_character(c, ctx.set_ion_type(IonType.BLOB))
          ctx.value.append(c)
          return num_digits, num_pads
  
      def validate(c, ctx, res):
          num_digits, num_pads = expand_res(res)
          if num_pads > 3 or (num_digits + num_pads) % 4 != 0:
              _illegal_character(c, ctx, 'Incorrect number of pad characters (%d) for a blob of %d base-64 digits.'
                                 % (num_pads, num_digits))
  
      return _lob_end_handler_factory(IonType.BLOB, action, validate)