human
1. Get Arxiv data about machine learning

Write a APi querier and extract papers with the terms machine learning or artificial intelligence. Get 2000 results... and play nice!"
Please write code following the instructions in jupyter notebook style.
 ... Can you provide a code to 1?
assistant
#Here is code to 1.

class Arxiv_querier():
    '''
    This class takes as an input a query and the number of results, and returns all the parsed results.
    Includes routines to deal with multiple pages of results.

    '''
    
    def __init__(self,base_url="http://export.arxiv.org/api/query?"):
        '''
        Initialise
        '''
        
        self.base_url = base_url
    
    def query(self,query_string,max_results=100,wait_time=3):
        '''
        Query the base url
        
        '''
        #Attribute query string
        
        #Load base URL
        base_url = self.base_url
        
        #Prepare query string
        processed_query = re.sub(' ','+',query_string)
        
        self.query_string="_".join(query_string.split(" "))
        
        start=0
        pages = 0
        
        #Run the query and store results for as long as the number of results is bigger than the max results
        keep_running = True
        
        result_store = []
        
        while keep_running==True:
            pages +=1
            print(pages)
            
            #Query url (NB the start arg, which will change as we go through different
            #pages)
            query_url = base_url+'search_query=all:{q}&start={s}&max_results={max_res}'.format(
                q=processed_query,s=start,max_res=max_results)
            
        
            #Download
            source = requests.get(query_url)
            
            #Parse the xml and get the entries (papers)
            parsed = feedparser.parse(source.content)
            
            #Extract entries
            entries = parsed['entries']
            
            #If the number of entries is bigger than the maximum number of results
            #this means we need to go to another page. We do that by offseting the
            #start with max results
            
            result_store.append(entries)
            
            if len(entries)==max_results:
                start+=max_results
            
            #If we have less...