<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Next block caches metadata for retrieving Supreme Court transcripts into a csv
Step1:  Should put a csv reading block here for faster processing
<ASSISTANT_TASK:>
Python Code:
import csv
with open("judicialMetadata.csv", "w+") as metadata:
    header = allRecentRecords[0].keys()
    writer = csv.DictWriter(metadata, fieldnames=header)
    writer.writerows(allRecentRecords)
Explanation: Next block caches metadata for retrieving Supreme Court transcripts into a csv
End of explanation
import pdfquery
import requests
def getPDFTree(url, tempURL):
    pdf = requests.get(url)
    with open(tempURL, "wb+", buffering=0) as fp:
        fp.write(pdf.content)
        pdfTree = pdfquery.PDFQuery(fp)
        pdfTree.load()
        return pdfTree
url = "https://www.supremecourt.gov/oral_arguments/argument_transcripts/2000/00-6374.pdf"
tempURL = "temp/argument_transcripts/2004/04-603.xml"
pdfTree = getPDFTree(url, tempURL)
pdfTree.tree.write("temp/argument_transcripts/2006/05-85.xml", pretty_print=True, encoding="utf-8")
TOContents = pdfTree.pq('LTTextLineHorizontal:contains("C O N T E N T S ")')
assert TOContents != None, "Table of contents is formatted differently"
import re
with open("temp/argument_transcripts/2004/04-603.xml") as fp:
    text = fp.read()
    tagRegex = r"\</?[^\<\>/]*\>"
    text = re.sub(tagRegex, "", text)
    text = re.sub(r'\n\s*[0-9]+', "\n", text)
    text = text.replace('FOURTEENTH STREET, N.W.WASHINGTON, D.C. 20005(800) FOR DEPO  ALDERSON REPORTING COMPANY, INC.  1111 FOURTEENTH STREET, N.W.  SUITE 400  WASHINGTON, D.C. 20005  (202)289-2260  (800) FOR DEPO', '')
    tocLength = text.find("C O N T E N T S ")
    print(text[tocLength  : ])
    
Explanation: Should put a csv reading block here for faster processing
End of explanation
<END_TASK>