code: def data2uri(data, data_type):
          
          MIME_MAP = {
              'image/jpeg': 'jpeg',
              'image/png': 'png',
              'text/plain': 'text',
              'text/html': 'html',
              'text/latex': 'latex',
              'application/javascript': 'html',
              'image/svg+xml': 'svg',
          }
          inverse_map = {v: k for k, v in list(MIME_MAP.items())}
          mime_type = inverse_map[data_type]
          uri = r"data:{mime};base64,{data}"
          return uri.format(mime=mime_type,
                            data=data[mime_type].replace('\n', ''))
docs: Convert base64 data into a data uri with the given data_type.