code: def pdf_to_markdown(response):
      # Download the PDF from the given URL
  
      file_stream = io.BytesIO(response.content)
  
      # Open the PDF from the in-memory file
      document = fitz.open(stream=file_stream, filetype="pdf")
  
      markdown_text = ""
      for page_num in range(len(document)):
          page = document.load_page(page_num)
  
          # Get the blocks of text
          blocks = page.get_text("blocks")
  
          # Sort the blocks by their vertical position on the page
          blocks.sort(key=lambda block: (block[1], block[0]))
  
          previous_block_bottom = 0
          for block in blocks:
              y0 = block[1]
              y1 = block[3]
              block_text = block[4]
  
              # Check if there's a large vertical gap between this block and the previous one
              if y0 - previous_block_bottom > 10:
                  markdown_text += "\n"
  
              markdown_text += block_text + "\n"
              previous_block_bottom = y1
  
          markdown_text += "\n"
  
      # Close the document
      document.close()
  
      return markdown_text
  
imports: import concurrent.futures
  import io
  import re
  import traceback
  from threading import Lock
  from urllib.parse import urljoin, urlparse
  import fitz
  import pandas
  import requests
  from bs4 import BeautifulSoup
  from mindsdb.utilities import log
label_desc: Use image node_id 1 for calling a global function with example usage: pdf_to_markdown(response) and returns: markdown_text