code: def get_caption(kv):
      
      caption = []
      typef = ""
      value, res = get_value(kv, u"caption")
      if value is not None:
          caption = [Str(value)]
          typef = "fig:"
  
      return caption, typef, res
docs: get caption from the keyvalues (options)
  
      Example:
        if key == 'CodeBlock':
          [[ident, classes, keyvals], code] = value
          caption, typef, keyvals = get_caption(keyvals)
          ...
          return Para([Image([ident, [], keyvals], caption, [filename, typef])])