code: def decode(data_url):
      
      metadata, data = data_url.rsplit(',', 1)
      _, metadata = metadata.split('data:', 1)
      parts = metadata.split(';')
      if parts[-1] == 'base64':
          data = b64decode(data)
      else:
          data = unquote(data)
  
      for part in parts:
          if part.startswith("charset="):
              data = data.decode(part[8:])
      return data
docs: Decode DataURL data