code: def get_imageblock(filename, format=''):
      
      _, extension = os.path.splitext(filename)
  
      with open(filename, "rb") as image_file:
          encoded_string = base64.b64encode(image_file.read()).decode('utf-8')
  
      return '\n\n.. raw:: html\n\n\t<img src="data:image/' + (format if format else extension[1:]) + ';base64,' + encoded_string +'">\n'
docs: Generates rst raw block for given image filename and format