I am looking to improve my code structure. In this code it is opening all the links with ?pid= in the url. However, the structure of the code can be improved.for a in self.soup.find_all(href=True):                href = a['href']    if not href or len(href) <= 1:        continue    if href[0] == '/':        href = (domain_link + href).strip()           if href.lower().find(?pid=) != -1:            href = href.strip()        elif 'javascript:' in href.lower():            continue        elif 'reviews' in href.lower():            continue    elif href[:4] == 'http':        if href.lower().find(?pid=) != -1:            href = href.strip()    elif href[0] != '/' and href[:4] != 'http':        href = ( domain_link + '/' + href ).strip()        if href.lower().find(?pid=) != -1:            href = href.strip()    if '#' in href:        indx = href.index('#')        href = href[:indx].strip()    if href in links:        continue    links.append(self.re_encode(href))self.dict['a_href'] = links
Opening all the links
python;url;beautifulsoup