NameError: name 'n' not defined Python, Flask : I have suddenly been getting the "NameError" when I run my flask code associated with the python code snippet posted below. I have similar functions defined which is basically web scraping using BS4, but the current function mentioned below throws this error when I run the flask code on localhost. 
I have researched on this error on SO, and have accordingly added the global definitions as well, but still no luck with resolving this. 
Any help is much appreciated. Thanks in advance!

Python code snippet:

    def bcnews(self):
        global n, l
        bcheadline = requests.get("https://www.bleepingcomputer.com/")
        soup=BeautifulSoup(bcheadline.content, 'html.parser')
        for data in soup.find_all('div', class_="bc_banner_item cz-banner-item"):
            for item in soup.find_all('div', class_="bc_banner_caption"):
                n = (item.find('h4').contents[0])
                break
            for links in item.find_all('a'):
                l = (links.get('href'))
                break
            break
        return (n,l)