code: def add_figure(self, key, url, **kwargs):
          
          figure = self._check_metadata_for_file(key=key, url=url, **kwargs)
  
          for dict_key in (
              'caption',
              'label',
              'material',
              'filename',
              'url',
              'original_url',
          ):
              if kwargs.get(dict_key) is not None:
                  figure[dict_key] = kwargs[dict_key]
  
          if key_already_there(figure, self.record.get('figures', ())):
              raise ValueError(
                  'There\'s already a figure with the key %s.'
                  % figure['key']
              )
  
          self._append_to('figures', figure)
          self.add_document
docs: Add a figure.
  
          Args:
              key (string): document key
              url (string): document url
          Keyword Args:
              caption (string): simple description
              label (string):
              material (string):
              original_url (string): original url
              filename (string): current url
  
          Returns: None